Changeset 1836


Ignore:
Timestamp:
Aug 30, 2012, 1:41:59 AM (9 years ago)
Author:
rez
Message:

COPPERBARS FUCK YEAH

Location:
trunk/tools/neercs
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/Makefile.am

    r1820 r1836  
    1212    video/text-render.cpp video/text-render.h \
    1313    video/simple.lolfx \
    14     video/blurh.lolfx video/blurv.lolfx video/glow.lolfx video/color.lolfx \
    15     video/remanency.lolfx video/noise.lolfx video/postfx.lolfx\
     14    video/blurh.lolfx video/blurv.lolfx video/glow.lolfx \
     15    video/remanency.lolfx video/copper.lolfx video/color.lolfx \
     16    video/noise.lolfx video/postfx.lolfx \
    1617    video/text.lolfx
    1718neercs_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ @CACA_CFLAGS@ -Iold
  • trunk/tools/neercs/neercs.cpp

    r1829 r1836  
    8787    caca_clear_canvas(m_caca);
    8888
    89     caca_set_color_argb(m_caca, 0x545, bg_color);
     89    caca_set_color_argb(m_caca, 0xfff, bg_color);
    9090    for(int i = 0; i < h; i++)
    9191    {
     
    114114    int logo_y = h / 2 - 2;
    115115
    116     caca_set_color_argb(m_caca, 0xfff, bg_color);
    117     //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);
     116    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);
    118117    caca_put_str(m_caca, logo_x + 3, logo_y    ,"__  _________ ______ ______ ______ ______");
    119     //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);
     118    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);
    120119    caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  >  __  >  __  >  ___//  ___/ \x0a9");
    121     //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);
     120    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);
    122121    caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/      /  ____/  ____/  __  <  <____\\___  \\");
    123     //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);
     122    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);
    124123    caca_put_str(m_caca, logo_x    , logo_y + 3, "/__/\\__/\\_______________/  \\________________\\");
    125124    caca_set_color_argb(m_caca, 0xdef, bg_color);
  • trunk/tools/neercs/neercs.vcxproj

    r1820 r1836  
    8484    <LolFxCompile Include="video\blurv.lolfx" />
    8585    <LolFxCompile Include="video\glow.lolfx" />
     86    <LolFxCompile Include="video\copper.lolfx" />
    8687    <LolFxCompile Include="video\color.lolfx" />
    8788    <LolFxCompile Include="video\remanency.lolfx" />
  • trunk/tools/neercs/neercs.vcxproj.filters

    r1820 r1836  
    130130      <Filter>video</Filter>
    131131    </LolFxCompile>
     132    <LolFxCompile Include="video\copper.lolfx">
     133      <Filter>video</Filter>
     134    </LolFxCompile>
    132135    <LolFxCompile Include="video\color.lolfx">
    133136      <Filter>video</Filter>
  • trunk/tools/neercs/video/color.lolfx

    r1829 r1836  
    1515uniform sampler2D texture;
    1616uniform vec2 screen_size;
    17 uniform float time;
    1817uniform vec3 filter;
    1918uniform vec3 color;
     
    2423        vec2 p=gl_FragCoord.xy/screen_size.xy;
    2524        vec3 c=texture2D(texture,p).xyz;
    26         vec3 o=c;
    27 
    28         float sinus=0.125+0.125*sin(p.x*float(screen_size.x/32)+time)+0.125*cos(p.y*float(screen_size.x/32)+time);
    29         vec3 copper=vec3(0.5+sinus);
    30         copper.x+=0.5*cos(p.y*float(screen_size.y/64)+time);
    31         copper.z+=0.5*sin(p.y*float(screen_size.y/64)+time);
    32         copper*=0.5+0.25*cos(p.y*float(screen_size.x/6)-time*2.0);
    33 
    34         copper.x=float(int(copper.x*8.0)*32)/256.0;
    35         copper.y=float(int(copper.y*8.0)*32)/256.0;
    36         copper.z=float(int(copper.z*8.0)*32)/256.0;
    3725
    3826        float a=(c.x+c.y+c.z)/3.0;
     
    4331        c+=flash;                                                                                               // flash
    4432
    45         //gl_FragColor=vec4(c,1.0);
    46         gl_FragColor=vec4((o.x>0.5&&o.y>0.5&&o.z>0.5)?copper:c,1.0);
     33        gl_FragColor=vec4(c,1.0);
    4734        }
  • trunk/tools/neercs/video/render.cpp

    r1829 r1836  
    3333
    3434extern char const *lolfx_simple;
    35 extern char const *lolfx_remanency;
    3635extern char const *lolfx_blurh;
    3736extern char const *lolfx_blurv;
    3837extern char const *lolfx_glow;
     38extern char const *lolfx_remanency;
     39extern char const *lolfx_copper;
    3940extern char const *lolfx_color;
    4041extern char const *lolfx_noise;
     
    9394vec2 glow_small(1.0f,1.0f);     // small glow radius [center,corner]
    9495vec2 blur(0.5f,0.5f);           // blur radius [center,corner]
     96vec4 copper(0.125,0.125,32,64); // copper [base,variable,repeat x,repeat y]
    9597vec3 color_filter(0.9f,0.9f,1.0f);    // color filter [red,green,blue]
    9698vec3 color_color(1.2f,1.1f,0.25f);    // color modifier [brightness,contrast,grayscale]
     
    365367
    366368Shader *shader_simple;
    367 Shader *shader_remanency;
    368 Shader *shader_blur_h, *shader_blur_v, *shader_glow, *shader_color;
     369Shader *shader_blur_h, *shader_blur_v, *shader_glow;
     370Shader *shader_remanency, *shader_copper, *shader_color;
    369371Shader *shader_noise, *shader_postfx;
    370372// shader variables
    371373ShaderUniform shader_simple_texture;
    372 ShaderUniform shader_remanency_source,
    373               shader_remanency_buffer,
    374               shader_remanency_mix;
    375374ShaderUniform shader_blur_h_texture,
    376375              shader_blur_h_radius,
     
    380379              shader_glow_source,
    381380              shader_glow_mix;
     381ShaderUniform shader_remanency_source,
     382              shader_remanency_buffer,
     383              shader_remanency_mix;
     384ShaderUniform shader_copper_texture,
     385              shader_copper_screen_size,
     386              shader_copper_time,
     387              shader_copper_copper;
    382388ShaderUniform shader_color_texture,
    383389              shader_color_screen_size,
    384               shader_color_time,
    385390              shader_color_filter,
    386391              shader_color_color,
     
    409414
    410415FrameBuffer *fbo_back, *fbo_front, *fbo_buffer;
    411 FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_ping, *fbo_pong;
     416FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_tmp;
    412417
    413418TextRender *text_render;
     
    450455    fbo_blur_h = new FrameBuffer(screen_size);
    451456    fbo_blur_v = new FrameBuffer(screen_size);
    452     fbo_ping = new FrameBuffer(screen_size);
    453     fbo_pong = new FrameBuffer(screen_size);
     457    fbo_tmp = new FrameBuffer(screen_size);
    454458    // shader simple
    455459    shader_simple = Shader::Create(lolfx_simple);
    456460    shader_simple_texture = shader_simple->GetUniformLocation("texture");
    457     // shader remanency
    458     shader_remanency = Shader::Create(lolfx_remanency);
    459     shader_remanency_source = shader_remanency->GetUniformLocation("source");
    460     shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer");
    461     shader_remanency_mix = shader_remanency->GetUniformLocation("mix");
    462461    // shader glow
    463462    shader_glow = Shader::Create(lolfx_glow);
     
    473472    shader_blur_v_texture = shader_blur_v->GetUniformLocation("texture");
    474473    shader_blur_v_radius = shader_blur_v->GetUniformLocation("radius");
     474    // shader remanency
     475    shader_remanency = Shader::Create(lolfx_remanency);
     476    shader_remanency_source = shader_remanency->GetUniformLocation("source");
     477    shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer");
     478    shader_remanency_mix = shader_remanency->GetUniformLocation("mix");
     479    // shader copper
     480    shader_copper = Shader::Create(lolfx_copper);
     481    shader_copper_texture = shader_copper->GetUniformLocation("texture");
     482    shader_copper_screen_size = shader_copper->GetUniformLocation("screen_size");
     483    shader_copper_time = shader_copper->GetUniformLocation("time");
     484    shader_copper_copper = shader_copper->GetUniformLocation("copper");
    475485    // shader color
    476486    shader_color = Shader::Create(lolfx_color);
    477487    shader_color_texture = shader_color->GetUniformLocation("texture");
    478488    shader_color_screen_size = shader_color->GetUniformLocation("screen_size");
    479     shader_color_time = shader_color->GetUniformLocation("time");
    480489    shader_color_filter = shader_color->GetUniformLocation("filter");
    481490    shader_color_color = shader_color->GetUniformLocation("color");
     
    538547    m_setup(true),
    539548    m_shader(true),
    540     m_shader_remanency(true),
    541549    m_shader_glow(true),
    542550    m_shader_blur(true),
     551    m_shader_remanency(true),
     552    m_shader_copper(true),
    543553    m_shader_color(true),
    544554    m_shader_noise(true),
     
    863873    glTexCoordPointer(2, GL_FLOAT, 0, fs_quad_tex);
    864874
     875    if (m_shader_copper)
     876    {
     877        // shader copper
     878        fbo_tmp->Bind();
     879        shader_copper->Bind();
     880        shader_copper->SetUniform(shader_copper_texture, fbo_back->GetTexture(), 0);
     881        shader_copper->SetUniform(shader_copper_screen_size, (vec2)screen_size);
     882        shader_copper->SetUniform(shader_copper_time, fx_angle);
     883        shader_copper->SetUniform(shader_copper_copper, copper);
     884        fs_quad();
     885        shader_color->Unbind();
     886        fbo_tmp->Unbind();
     887        // shader simple
     888        fbo_back->Bind();
     889        draw_shader_simple(fbo_tmp, 0);
     890        fbo_back->Unbind();
     891    }
     892
    865893    if (m_shader_remanency)
    866894    {
    867895        // shader remanency
    868         fbo_ping->Bind();
     896        fbo_tmp->Bind();
    869897        shader_remanency->Bind();
    870898        shader_remanency->SetUniform(shader_remanency_source, fbo_back->GetTexture(), 0);
     
    873901        fs_quad();
    874902        shader_remanency->Unbind();
    875         fbo_ping->Unbind();
     903        fbo_tmp->Unbind();
    876904        // shader simple
    877905        fbo_back->Bind();
    878         draw_shader_simple(fbo_ping, 0);
     906        draw_shader_simple(fbo_tmp, 0);
    879907        fbo_back->Unbind();
    880908        // save previous fbo
    881         fbo_ping->Bind();
     909        fbo_tmp->Bind();
    882910        shader_remanency->Bind();
    883911        shader_remanency->SetUniform(shader_remanency_source, fbo_front->GetTexture(), 0);
     
    886914        fs_quad();
    887915        shader_remanency->Unbind();
    888         fbo_ping->Unbind();
     916        fbo_tmp->Unbind();
    889917        // shader simple
    890918        fbo_buffer->Bind();
    891         draw_shader_simple(fbo_ping, 0);
     919        draw_shader_simple(fbo_tmp, 0);
    892920        fbo_buffer->Unbind();
    893921    }
     
    949977    {
    950978        // shader color
    951         fbo_ping->Bind();
     979        fbo_tmp->Bind();
    952980        shader_color->Bind();
    953981        shader_color->SetUniform(shader_color_texture, fbo_front->GetTexture(), 0);
    954982        shader_color->SetUniform(shader_color_screen_size, (vec2)screen_size);
    955         shader_color->SetUniform(shader_color_time, fx_angle);
    956983        shader_color->SetUniform(shader_color_filter, color_filter);
    957984        shader_color->SetUniform(shader_color_color, color_color);
     
    959986        fs_quad();
    960987        shader_color->Unbind();
    961         fbo_ping->Unbind();
     988        fbo_tmp->Unbind();
    962989        // shader simple
    963990        fbo_front->Bind();
    964         draw_shader_simple(fbo_ping, 0);
     991        draw_shader_simple(fbo_tmp, 0);
    965992        fbo_front->Unbind();
    966993    }
     
    969996    {
    970997        // shader noise
    971         fbo_ping->Bind();
     998        fbo_tmp->Bind();
    972999        shader_noise->Bind();
    9731000        shader_noise->SetUniform(shader_noise_texture, fbo_front->GetTexture(), 0);
     
    9791006        fs_quad();
    9801007        shader_noise->Unbind();
    981         fbo_ping->Unbind();
     1008        fbo_tmp->Unbind();
    9821009        // shader simple
    9831010        fbo_front->Bind();
    984         draw_shader_simple(fbo_ping, 0);
     1011        draw_shader_simple(fbo_tmp, 0);
    9851012        fbo_front->Unbind();
    9861013    }
     
    9891016    {
    9901017        // shader blur horizontal
    991         fbo_ping->Bind();
     1018        fbo_tmp->Bind();
    9921019        shader_blur_h->Bind();
    9931020        shader_blur_h->SetUniform(shader_blur_h_texture, fbo_front->GetTexture(), 0);
     
    9951022        fs_quad();
    9961023        shader_blur_h->Unbind();
    997         fbo_ping->Unbind();
     1024        fbo_tmp->Unbind();
    9981025        // shader blur vertical
    9991026        fbo_front->Bind();
    10001027        shader_blur_v->Bind();
    1001         shader_blur_v->SetUniform(shader_blur_v_texture, fbo_ping->GetTexture(), 0);
     1028        shader_blur_v->SetUniform(shader_blur_v_texture, fbo_tmp->GetTexture(), 0);
    10021029        shader_blur_v->SetUniform(shader_blur_v_radius, blur / screen_size.y);
    10031030        fs_quad();
  • trunk/tools/neercs/video/render.h

    r1820 r1836  
    3434    bool m_setup;
    3535    bool m_shader;
    36     bool m_shader_remanency;
    3736    bool m_shader_glow;
    3837    bool m_shader_blur;
     38    bool m_shader_remanency;
     39    bool m_shader_copper;
    3940    bool m_shader_color;
    4041    bool m_shader_noise;
Note: See TracChangeset for help on using the changeset viewer.