Changeset 2039 for trunk/tools


Ignore:
Timestamp:
Oct 23, 2012, 1:10:22 AM (7 years ago)
Author:
rez
Message:

neercs: added a protection glass above the monitor

Location:
trunk/tools/neercs
Files:
4 edited

Legend:

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

    r2020 r2039  
    150150    if (m_debug)
    151151    {
    152         m_time += seconds;
    153152        DrawFancyShit();
    154153    }
     
    187186{
    188187    /* draw something awesome */
    189     int bg_color = 0x222;
     188    int bg_color = 0x000;
    190189    int w = caca_get_canvas_width(m_caca);
    191190    int h = caca_get_canvas_height(m_caca);
     
    222221
    223222    caca_set_color_argb(m_caca, 0xbac, bg_color);
    224     //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);
    225223    caca_put_str(m_caca, logo_x + 3, logo_y    ,"__  _________ ______ ______ ______ ______");
    226     //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);
    227224    caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  >  __  >  __  >  ___//  ___/ \x0a9");
    228     //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);
    229225    caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/      /  ____/  ____/  __  <  <____\\___  \\");
    230     //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);
    231226    caca_put_str(m_caca, logo_x    , logo_y + 3, "/__/\\__/\\_______________/  \\________________\\");
    232227    caca_set_color_argb(m_caca, 0x269, bg_color);
     
    247242|______|/
    248243*/
    249 
    250     int lolcube_x = w / 2 - 5 + (w - 10) * lol::cos(m_time / 2);
    251     int lolcube_y = h - 5 - abs ((h - 5) * lol::sin(m_time * 4));
    252 
    253     caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::sin(m_time * 2), 0.5f + 0.5f * lol::cos(m_time * 3), 0.5f + 0.5f * lol::sin(m_time * 5)), bg_color);
     244/*
     245    int lolcube_x = w - 12;
     246    int lolcube_y = h - 8;
     247
     248    caca_set_color_argb(m_caca, 0x777, bg_color);
    254249    caca_put_str(m_caca, lolcube_x + 2, lolcube_y    , "_______");
    255250    caca_put_str(m_caca, lolcube_x + 1, lolcube_y + 1, "/      /|");
     
    258253    caca_put_str(m_caca, lolcube_x    , lolcube_y + 4, "|  :D  | /");
    259254    caca_put_str(m_caca, lolcube_x    , lolcube_y + 5, "|______|/");
     255*/
    260256
    261257    caca_set_color_argb(m_caca, 0x777, bg_color);
    262     caca_put_str(m_caca, 0, 0, "rez@lol:~/ sudo -s");
    263     caca_put_str(m_caca, 0, 1, "[sudo] password for rez:");
    264     caca_put_str(m_caca, 0, 2, "root@lol:~/ echo LOL");
    265     caca_put_str(m_caca, 0, 3, "LOL");
    266     caca_put_str(m_caca, 0, 4, "root@lol:~/");
    267 }
     258    caca_put_str(m_caca, 0, 0, "rez@lol:~/code/neercs/");
     259}
  • trunk/tools/neercs/video/mirror.lolfx

    r2017 r2039  
    2323
    2424    vec3 c = vec3(0.0);
    25     if(p.x < mirror.x) c += (texture2D(texture, vec2(mirror.x + (mirror.x - p.x) * mirror.w, p.y * (0.8 + 2.0 * p.x) + 0.1 - 1.0 * p.x)).xyz) * (mirror.z / mirror.x * p.x);
    26     if(p.x > 1.0 - mirror.x) c += (texture2D(texture, vec2(- mirror.x - (mirror.x + p.x) * mirror.w, p.y * (0.8 + 2.0 * (1.0 - p.x)) + 0.1 - 1.0 * (1.0 - p.x))).xyz) * (mirror.z / mirror.x * (1.0 - p.x));
    27     if(p.y < mirror.y) c += (texture2D(texture, vec2(p.x * (0.8 + 2.0 * p.y) + 0.1 - 1.0 * p.y, mirror.y + (mirror.y - p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * p.y);
    28     if(p.y > 1.0 - mirror.y) c += (texture2D(texture, vec2(p.x * (0.8 + 2.0 * (1.0 - p.y)) + 0.1 - 1.0 * (1.0 - p.y), - mirror.y - (mirror.y + p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * (1.0 - p.y));
     25    if(p.x < mirror.x) c += texture2D(texture, vec2(mirror.x + (mirror.x - p.x) * mirror.w, p.y * (0.8 + 2.0 * p.x) + 0.1 - 1.0 * p.x)).xyz * (mirror.z / mirror.x * p.x);
     26    if(p.x > 1.0 - mirror.x) c += texture2D(texture, vec2(- mirror.x - (mirror.x + p.x) * mirror.w, p.y * (0.8 + 2.0 * (1.0 - p.x)) + 0.1 - 1.0 * (1.0 - p.x))).xyz * (mirror.z / mirror.x * (1.0 - p.x));
     27    if(p.y < mirror.y) c += texture2D(texture, vec2(p.x * (0.8 + 2.0 * p.y) + 0.1 - 1.0 * p.y, mirror.y + (mirror.y - p.y) * mirror.w)).xyz * (mirror.z / mirror.y * p.y);
     28    if(p.y > 1.0 - mirror.y) c += texture2D(texture, vec2(p.x * (0.8 + 2.0 * (1.0 - p.y)) + 0.1 - 1.0 * (1.0 - p.y), - mirror.y - (mirror.y + p.y) * mirror.w)).xyz * (mirror.z / mirror.y * (1.0 - p.y));
    2929
    3030    gl_FragColor = vec4(s + c, 1.0);
  • trunk/tools/neercs/video/postfx.lolfx

    r2021 r2039  
    2020uniform vec4 ghost1;
    2121uniform vec4 ghost2;
     22uniform vec4 glass;
    2223uniform float vignetting;
    2324uniform float aberration;
     
    3031uniform float beat;
    3132
    32 vec2 screen(in vec2 p,in float radius)
     33vec2 screen(in vec2 p,in float bend,in float radius)
    3334{
    34     float d=deform.x+sync*0.0625+beat*0.0375;
     35    float d=bend+sync*0.0625+beat*0.0375;
    3536    return p*(1.5-(radius*cos(p.x*d)+radius*cos(p.y*d)))-0.5;
    3637}
     
    5152    vec2 p=-1.0+2.0*gl_FragCoord.xy/screen_size.xy;
    5253    p.y+=0.025*sync;
    53     vec2 z=screen(p,deform.y);
    54     vec2 z1=screen(p,deform.y+ghost1.z*0.01);
    55     vec2 z2=screen(p,deform.y+ghost2.z*0.01);
     54    vec2 z=screen(p,deform.x,deform.y);
     55    vec2 z1=screen(p,deform.x,deform.y+ghost1.z);
     56    vec2 z2=screen(p,deform.x,deform.y+ghost2.z);
     57    vec2 z3=screen(p,glass.w,deform.y+glass.x-glass.y);
     58    vec2 z4=screen(p,glass.w,deform.y+glass.x+glass.y);
    5659    float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);
    5760
    5861    vec3 source=get_color(texture,z);
    59     vec3 g1=get_color(texture,z1-ghost1.xy*0.01);
    60     vec3 g2=get_color(texture,z2-ghost2.xy*0.01);
     62    vec3 g1=get_color(texture,z1-ghost1.xy);
     63    vec3 g2=get_color(texture,z2-ghost2.xy);
     64    vec3 g3=get_color(texture,z3);
     65    vec3 g4=get_color(texture,z4);
    6166
    6267    vec3 c=source+g1*ghost1.w+g2*ghost2.w;                   // mix
    6368
    64     float v=aberration/float(screen_size.x/ratio_2d.x);//+aberration/float(screen_size.x)*(2.0-mask);
     69    float v=aberration/float(screen_size.x/ratio_2d.x);      //+aberration/float(screen_size.x)*(2.0-mask);
    6570    vec3 ca1=get_color(texture,vec2(z.x-v,z.y));
    6671    vec3 ca2=get_color(texture,vec2(z.x+v,z.y));
     
    8994    c*=mix(1.0,mask,vignetting);                             // vignetting
    9095    c*=letterbox(z,corner.x+2.0,corner.y,corner.z);          // corner
     96    c+=(g3+g4)*glass.z;                                      // glass
    9197    gl_FragColor=vec4(c,1.0);
    9298}
  • trunk/tools/neercs/video/render.cpp

    r2021 r2039  
    113113vec4 postfx_ghost1(1.0f,0.0f,0.0f,-0.25f);      // ghost picture 1 [position x,position y,position z,strength]
    114114vec4 postfx_ghost2(1.5f,0.0f,0.0f,0.25f);       // ghost picture 2 [position x,position y,position z,strength]
     115vec4 postfx_glass(8.0f,0.25f,0.75f,0.2f);       // glass [depth,thickness,strength,deform ratio]
    115116vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f);    // vertical moire [base,variable,repeat,shift]
    116 vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f);    // horizontal moire [base,variable,repeat,shift]
     117vec4 postfx_moire_v(0.75f,-0.25f,1.0f,2.0f);    // horizontal moire [base,variable,repeat,shift]
    117118vec4 postfx_scanline_h(1.0f,0.0f,0.0f,0.0f);    // vertical scanline [base,variable,repeat,shift]
    118119vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat,shift]
    119120vec3 postfx_corner(0.0f,0.8f,0.96f);            // corner [width,radius,blur]
    120121vec4 mirror(0.95f,0.9f,0.4f,4.0f);              // mirror [width,height,strength,ratio]
    121 vec4 radial(4.0f,0.9f,16,0.5f);                 // radial [distance,fade ratio,iteration,strength]
     122vec4 radial(4.0f,0.9f,16,0.25f);                // radial [distance,fade ratio,iteration,strength]
    122123/* text variable */
    123124ivec2 ratio_2d(2,3);            // 2d ratio
     
    133134int setup_cursor = 0;           // cursor position
    134135int setup_option_i = 0;         // selected option
    135 int setup_option_n = 13;        // option number
     136int setup_option_n = 14;        // option number
    136137int setup_option_p = 0;         // option position
    137138int setup_item_i = 0;           // selected item
     
    224225        "front z",
    225226        "front strength",
     227    "glass",
     228        "depth",
     229        "thickness",
     230        "strength",
     231        "deform ratio",
     232        "",
     233        "",
     234        "",
     235        "",
    226236    "moire",
    227237        "h base",
     
    344354        vec4(-2.0f, 2.0f, 0.10f, postfx_ghost2.z),
    345355        vec4(-1.0f, 1.0f, 0.05f, postfx_ghost2.w),
     356    vec4(0), /* glass */
     357        vec4(0.0f, 16.0f, 0.50f, postfx_glass.x),
     358        vec4(0.0f,  1.0f, 0.05f, postfx_glass.y),
     359        vec4(0.0f,  2.0f, 0.05f, postfx_glass.z),
     360        vec4(0.0f,  1.0f, 0.05f, postfx_glass.w),
     361        vec4(0),
     362        vec4(0),
     363        vec4(0),
     364        vec4(0),
    346365    vec4(0), /* moire */
    347366        vec4( 0.5f, 1.0f, 0.05f, postfx_moire_h.x),
     
    421440    postfx_ghost1 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    422441    postfx_ghost2 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    423     k += 1; /* moire */
     442    k += 1; /* glass */
     443    postfx_glass = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     444    k += 5; /* moire */
    424445    postfx_moire_h = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    425446    postfx_moire_v = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     
    500521              shader_postfx_ghost1,
    501522              shader_postfx_ghost2,
     523              shader_postfx_glass,
    502524              shader_postfx_vignetting,
    503525              shader_postfx_aberration,
     
    601623    shader_postfx_ghost1 = shader_postfx->GetUniformLocation("ghost1");
    602624    shader_postfx_ghost2 = shader_postfx->GetUniformLocation("ghost2");
     625    shader_postfx_glass = shader_postfx->GetUniformLocation("glass");
    603626    shader_postfx_vignetting = shader_postfx->GetUniformLocation("vignetting");
    604627    shader_postfx_aberration = shader_postfx->GetUniformLocation("aberration");
     
    13101333        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
    13111334        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
    1312         shader_postfx->SetUniform(shader_postfx_ghost1, postfx_ghost1);
    1313         shader_postfx->SetUniform(shader_postfx_ghost2, postfx_ghost2);
     1335        shader_postfx->SetUniform(shader_postfx_ghost1, vec4(postfx_ghost1.x * 0.01, postfx_ghost1.y * 0.01, postfx_ghost1.z * 0.01, postfx_ghost1.w));
     1336        shader_postfx->SetUniform(shader_postfx_ghost2, vec4(postfx_ghost2.x * 0.01, postfx_ghost2.y * 0.01, postfx_ghost2.z * 0.01, postfx_ghost2.w));
     1337        shader_postfx->SetUniform(shader_postfx_glass, vec4(postfx_glass.x * 0.01, postfx_glass.y * 0.01, postfx_glass.z * 0.1, postfx_glass.w));
    13141338        shader_postfx->SetUniform(shader_postfx_vignetting, postfx_vignetting);
    13151339        shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
Note: See TracChangeset for help on using the changeset viewer.