Changeset 1644


Ignore:
Timestamp:
Jul 18, 2012, 12:57:28 AM (8 years ago)
Author:
rez
Message:

remanency expanded to 6 buffers, 3 ared used and blended (2,4 and 6)

Location:
trunk/tools/neercs
Files:
5 edited

Legend:

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

    r1642 r1644  
    7777    caca_clear_canvas(m_caca);
    7878
    79     caca_set_color_argb(m_caca, 0xc48, bg_color);
     79    caca_set_color_argb(m_caca, 0xa46, bg_color);
    8080    for(int i = 0; i < h; i++)
    8181    {
     
    121121    caca_printf(m_caca, 2, h - 2, "H=%i", h);
    122122
    123     caca_set_color_argb(m_caca, hex_color(0.6f + 0.4f * lol::cos(m_time * 2), 0.125f, 0.125f), bg_color);
     123    caca_set_color_argb(m_caca, hex_color(0.6f + 0.4f * lol::cos(m_time * 2), 0.2f, 0.2f), bg_color);
    124124    caca_put_str(m_caca, w - 12, h - 2, "CACA RULEZ");
    125125}
  • trunk/tools/neercs/video/remanency.lolfx

    r1638 r1644  
    1414
    1515uniform sampler2D texture;
    16 uniform sampler2D texture_prv;
     16uniform sampler2D texture_buffer1;
     17uniform sampler2D texture_buffer2;
     18uniform sampler2D texture_buffer3;
    1719uniform vec2 screen_size;
    1820uniform float time;
    19 uniform float value;
     21uniform float value1;
     22uniform float value2;
    2023
    2124void main(void)
     
    2326        vec2 p=gl_TexCoord[0].xy;
    2427        vec4 source=texture2D(texture,p);
    25         vec4 remanency=texture2D(texture_prv,p);
    26         vec4 color=source*(1.0-value)+remanency*value;
     28        vec4 buffer1=texture2D(texture_buffer1,p);
     29        vec4 buffer2=texture2D(texture_buffer2,p);
     30        vec4 buffer3=texture2D(texture_buffer3,p);
     31        vec4 color=source*value1+buffer1*value2+buffer2*value2+buffer3*value2;
    2732        gl_FragColor=color;
    2833        }
  • trunk/tools/neercs/video/render.cpp

    r1638 r1644  
    5151float farplane = 1000.0f;  // farplane
    5252int polygon_fillmode = GL_FILL; // fill mode
    53 bool key_state = 0;      // key state
     53bool key_state = 0;        // key state
    5454/* window variable */
    5555ivec2 screen_size;         // screen size
     
    8585ivec2 border;              // border width
    8686/* text variable */
    87 ivec2 ratio_2d(1,3);       // 2d ratio
     87ivec2 ratio_2d(2,4);       // 2d ratio
    8888ivec2 map_size(256,256);   // texture map size
    8989ivec2 font_size(8,8);      // font size
     
    117117              shader_blur_v_value;
    118118ShaderUniform shader_remanency_texture,
    119               shader_remanency_texture_prv,
     119              shader_remanency_texture_buffer1,
     120              shader_remanency_texture_buffer2,
     121              shader_remanency_texture_buffer3,
    120122              shader_remanency_screen_size,
    121123              shader_remanency_time,
    122               shader_remanency_value;
     124              shader_remanency_value1,
     125              shader_remanency_value2;
    123126ShaderUniform shader_glow_texture,
    124127              shader_glow_texture_prv,
     
    144147              shader_postfx_sync;
    145148
    146 FrameBuffer *fbo_back, *fbo_front, *fbo_buffer;
     149FrameBuffer *fbo_back, *fbo_front;
     150FrameBuffer *fbo_buffer1, *fbo_buffer2, *fbo_buffer3, *fbo_buffer4, *fbo_buffer5, *fbo_buffer6;
    147151FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_ping, *fbo_pong;
    148152
     
    183187    fbo_back = new FrameBuffer(screen_size);
    184188    fbo_front = new FrameBuffer(screen_size);
    185     fbo_buffer = new FrameBuffer(screen_size);
     189    fbo_buffer1 = new FrameBuffer(screen_size);
     190    fbo_buffer2 = new FrameBuffer(screen_size);
     191    fbo_buffer3 = new FrameBuffer(screen_size);
     192    fbo_buffer4 = new FrameBuffer(screen_size);
     193    fbo_buffer5 = new FrameBuffer(screen_size);
     194    fbo_buffer6 = new FrameBuffer(screen_size);
    186195    fbo_blur_h = new FrameBuffer(screen_size / glow_fbo_size);
    187196    fbo_blur_v = new FrameBuffer(screen_size / glow_fbo_size);
     
    206215    shader_remanency = Shader::Create(lolfx_remanency);
    207216    shader_remanency_texture = shader_remanency->GetUniformLocation("texture");
    208     shader_remanency_texture_prv = shader_remanency->GetUniformLocation("texture_prv");
     217    shader_remanency_texture_buffer1 = shader_remanency->GetUniformLocation("texture_buffer1");
     218    shader_remanency_texture_buffer2 = shader_remanency->GetUniformLocation("texture_buffer2");
     219    shader_remanency_texture_buffer3 = shader_remanency->GetUniformLocation("texture_buffer3");
    209220    shader_remanency_screen_size = shader_remanency->GetUniformLocation("screen_size");
    210221    shader_remanency_time = shader_remanency->GetUniformLocation("time");
    211     shader_remanency_value = shader_remanency->GetUniformLocation("value");
     222    shader_remanency_value1 = shader_remanency->GetUniformLocation("value1");
     223    shader_remanency_value2 = shader_remanency->GetUniformLocation("value2");
    212224    // shader glow
    213225    shader_glow = Shader::Create(lolfx_glow);
     
    245257{
    246258    screen_size = Video::GetSize();
    247     border = 24 * ratio_2d;
     259    border = 18 * ratio_2d;
    248260    border.y = border.x; // enabled to get same border everywhere
    249261    canvas_char = (screen_size - border * 2) / (font_size * ratio_2d);
     
    429441        shader_remanency->Bind();
    430442        shader_remanency->SetTexture(shader_remanency_texture, fbo_back->GetTexture(), 0);
    431         shader_remanency->SetTexture(shader_remanency_texture_prv, fbo_buffer->GetTexture(), 1);
     443        shader_remanency->SetTexture(shader_remanency_texture_buffer1, fbo_buffer2->GetTexture(), 1);
     444        shader_remanency->SetTexture(shader_remanency_texture_buffer2, fbo_buffer4->GetTexture(), 2);
     445        shader_remanency->SetTexture(shader_remanency_texture_buffer3, fbo_buffer6->GetTexture(), 3);
    432446        shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
    433447        shader_remanency->SetUniform(shader_remanency_time, fx_angle);
    434         shader_remanency->SetUniform(shader_remanency_value, 0.8f);
     448        shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
     449        shader_remanency->SetUniform(shader_remanency_value2, 0.25f);
    435450        fs_quad();
    436451        shader_remanency->Unbind();
     
    441456        fbo_back->Unbind();
    442457        // save previous fbo
    443         fbo_buffer->Bind();
     458        fbo_buffer6->Bind();
     459        draw_shader_simple(fbo_buffer5, 0);
     460        fbo_buffer6->Unbind();
     461        fbo_buffer5->Bind();
     462        draw_shader_simple(fbo_buffer4, 0);
     463        fbo_buffer5->Unbind();
     464        fbo_buffer4->Bind();
     465        draw_shader_simple(fbo_buffer3, 0);
     466        fbo_buffer4->Unbind();
     467        fbo_buffer3->Bind();
     468        draw_shader_simple(fbo_buffer2, 0);
     469        fbo_buffer3->Unbind();
     470        fbo_buffer2->Bind();
     471        draw_shader_simple(fbo_buffer1, 0);
     472        fbo_buffer2->Unbind();
     473        fbo_buffer1->Bind();
    444474        draw_shader_simple(fbo_front, 0);
    445         fbo_buffer->Unbind();
     475        fbo_buffer1->Unbind();
    446476    }
    447477
     
    454484        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f));
    455485        shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    456         shader_blur_h->SetUniform(shader_blur_h_value, 0.5f/screen_size.x);
     486        shader_blur_h->SetUniform(shader_blur_h_value, 0.375f/screen_size.x);
    457487        fs_quad();
    458488        shader_blur_h->Unbind();
     
    464494        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f));
    465495        shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    466         shader_blur_v->SetUniform(shader_blur_v_value, 0.5f/screen_size.y);
     496        shader_blur_v->SetUniform(shader_blur_v_value, 0.375f/screen_size.y);
    467497        fs_quad();
    468498        shader_blur_v->Unbind();
     
    484514        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    485515        shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    486         shader_blur_h->SetUniform(shader_blur_h_value, 2.25f / screen_size.x);
     516        shader_blur_h->SetUniform(shader_blur_h_value, 2.5f / screen_size.x);
    487517        fs_quad();
    488518        shader_blur_h->Unbind();
     
    494524        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    495525        shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    496         shader_blur_v->SetUniform(shader_blur_h_value, 2.25f / screen_size.y);
     526        shader_blur_v->SetUniform(shader_blur_h_value, 2.5f / screen_size.y);
    497527        fs_quad();
    498528        shader_blur_v->Unbind();
  • trunk/tools/neercs/video/render.h

    r1638 r1644  
    11//
     2// Neercs
    23//
    34
  • trunk/tools/neercs/video/text.lolfx

    r1588 r1644  
    5555    gl_FragColor = mix(pass_Background, pass_Foreground, t);
    5656}
    57 
Note: See TracChangeset for help on using the changeset viewer.