Changeset 1706


Ignore:
Timestamp:
Aug 8, 2012, 1:56:07 AM (7 years ago)
Author:
rez
Message:

setup menu - added Render::UpdateVar(int key) function

Location:
trunk/tools/neercs/video
Files:
3 edited

Legend:

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

    r1703 r1706  
    9696bool setup_switch=false;        // switch [option/item]
    9797int setup_option=0;             // selected option
    98 int setup_option_n=6;           // option number
     98int setup_option_n=7;           // option number
    9999int setup_item=0;               // selected item
    100100int setup_item_n=8;             // item number
     101int setup_item_key=0;           // item array key
    101102ivec2 setup_p(1,1);             // position [x,y]
    102103ivec3 setup_size(30,0,12);      // size [w,h,split]
     
    107108        "buffer new frame",
    108109        "buffer old frame",
    109         "source",
    110         "buffer",
    111         "",
    112         "",
    113         "",
    114     "glow/blur",
    115         "glow enable",
    116         "glow large center",
    117         "glow large corner",
    118         "glow small center",
    119         "glow small corner",
     110        "source mix",
     111        "buffer mix",
     112        "",
     113        "",
     114        "",
     115    "glow",
     116        "enable",
     117        "source mix",
     118        "glow mix",
     119        "large center",
     120        "large corner",
     121        "small center",
     122        "small corner",
     123        "",
     124    "blur",
    120125        "blur enable",
    121126        "blur center",
    122127        "blur corner",
     128        "",
     129        "",
     130        "",
     131        "",
     132        "",
    123133    "color",
    124134        "filter red",
     
    161171float value, angle, radius, scale, speed;
    162172/* shader variable */
    163 vec2 buffer(0.75f,0.25f);       // [new frame mix,old frame mix]
    164 vec2 remanency(0.25f,0.75f);    // remanency [source mix,buffer mix]
     173vec2 buffer(0.8f,0.2f);         // [new frame mix,old frame mix]
     174vec2 remanency(0.2f,0.8f);      // remanency [source mix,buffer mix]
    165175vec2 glow_mix(0.5f,0.5f);       // glow mix [source mix,glow mix]
    166176vec2 glow_large(2.0f,2.0f);     // large glow radius [center,corner]
     
    171181float postfx_deform = 0.625f;   // deformation ratio
    172182vec3 postfx_filter(0.875f,0.75f,1.0f);// color filter [red,green,blue]
    173 vec3 postfx_color(1.75f,1.75f,0.5f);  // color modifier [brightness,contrast,grayscale]
    174 vec3 postfx_retrace(0.025f,2.0f,4.0f);// retrace [color,length,speed]
     183vec3 postfx_color(1.8f,1.8f,0.5f);    // color modifier [brightness,contrast,grayscale]
     184vec3 postfx_retrace(0.04f,2.0f,4.0f); // retrace [color,length,speed]
    175185vec2 postfx_offset(3.0f,3.0f);  // random line [horizontal,vertical]
    176186float postfx_noise = 0.125f;    // noise
     
    183193vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f);// horizontal scanline [base,variable,repeat x,repeat y]
    184194//------------------------------//
    185 //00:29 <@sam> Array<vec4> toto;
    186 //00:29 <@sam> toto << vec4(1.f, 2.f, 3.f, 4.f);
    187195vec4 setup_var[]={
    188196    vec4(0), /* remanency */
     
    195203        vec4(0),
    196204        vec4(0),
    197     vec4(0), /* glow/blur */
     205    vec4(0), /* glow */
    198206        vec4(0, 1, 1, 0),
     207        vec4(0.0f, 1.0f, 0.1f, glow_mix.x),
     208        vec4(0.0f, 1.0f, 0.1f, glow_mix.y),
    199209        vec4(0.0f, 8.0f, 0.1f, glow_large.x),
    200210        vec4(0.0f, 8.0f, 0.1f, glow_large.y),
    201211        vec4(0.0f, 4.0f, 0.1f, glow_small.x),
    202212        vec4(0.0f, 4.0f, 0.1f, glow_small.y),
     213    vec4(0), /* blur */
    203214        vec4(0, 1, 1, 0),
    204215        vec4(0.0f, 2.0f, 0.1f, blur.x),
     
    206217    vec4(0) /* color */
    207218    };
     219
     220void Render::UpdateVar(int key)
     221{
     222    int k = key;
     223    m_shader_remanency = (setup_var[k].w == 1) ? true : false; k += 8;
     224    m_shader_glow = (setup_var[k].w == 1) ? true : false;
     225}
    208226
    209227Shader *shader_simple;
     
    403421    if (Input::GetButtonState(283/*SDLK_F2*/) && (timer - timer_key > timer_key_repeat))
    404422    {
    405         /*
    406423        m_polygon = !m_polygon;
    407424        polygon_fillmode = (m_polygon)?GL_FILL:GL_LINE;
    408425        glPolygonMode(GL_FRONT, polygon_fillmode);
    409         */
    410426        timer_key = timer;
    411427    }
     
    424440    {
    425441        Pause();
     442    }
     443   if (Input::GetButtonState(9/*SDLK_TAB*/)&&(timer-timer_key>timer_key_repeat))
     444    {
     445        if (m_setup)
     446        {
     447            setup_switch = !setup_switch;
     448        }
     449        timer_key = timer;
    426450    }
    427451    if (Input::GetButtonState(273/*SDLK_UP*/)&&(timer-timer_key>timer_key_repeat))
     
    465489        if (m_setup && setup_switch)
    466490        {
    467             int k = setup_option * (setup_item_n + 1) + 1 + setup_item;
    468             setup_var[k].w -= setup_var[k].z;
    469             if (setup_var[k].w < setup_var[k].x) setup_var[k].w = setup_var[k].x;
     491            setup_var[setup_item_key].w -= setup_var[setup_item_key].z;
     492            if (setup_var[setup_item_key].w < setup_var[setup_item_key].x) setup_var[setup_item_key].w = setup_var[setup_item_key].x;
     493            Render::UpdateVar(setup_item_key);
    470494        }
    471495        timer_key = timer;
     
    475499        if (m_setup && setup_switch)
    476500        {
    477             int k = setup_option * (setup_item_n + 1) + 1 + setup_item;
    478             setup_var[k].w += setup_var[k].z;
    479             if (setup_var[k].w > setup_var[k].y) setup_var[k].w = setup_var[k].y;
     501            setup_var[setup_item_key].w += setup_var[setup_item_key].z;
     502            if (setup_var[setup_item_key].w > setup_var[setup_item_key].y) setup_var[setup_item_key].w = setup_var[setup_item_key].y;
     503            Render::UpdateVar(setup_item_key);
    480504        }
    481505        timer_key = timer;
     
    483507    if (Input::GetButtonState(13/*SDLK_RETURN*/)&&(timer-timer_key>timer_key_repeat))
    484508    {
    485         if (m_setup)
    486         {
    487             setup_switch = !setup_switch;
    488         }
    489509        timer_key = timer;
    490510    }
     
    596616        if (setup_switch)
    597617        {
    598             int k = setup_option * (setup_item_n + 1) + 1 + setup_item;
     618            setup_item_key = setup_option * (setup_item_n + 1) + 1 + setup_item;
    599619            int w = setup_size.x - 3 - 4;
    600             caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[k].w);
    601             caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + w, y,'-');
    602             if(setup_var[k].w > setup_var[k].x) caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + int(w / (setup_var[k].y - setup_var[k].x) * setup_var[k].w), y,'X');
     620            caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
     621            caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + w, y,'.');
     622            if(setup_var[setup_item_key].w > setup_var[setup_item_key].x) caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + int(w / (setup_var[setup_item_key].y - setup_var[setup_item_key].x) * setup_var[setup_item_key].w), y,'x');
    603623        }
    604624    }
  • trunk/tools/neercs/video/render.h

    r1703 r1706  
    2626    void Pause();
    2727    void Shader();
     28    void UpdateVar(int key);
    2829
    2930    caca_canvas_t *m_caca;
  • trunk/tools/neercs/video/text-render.cpp

    r1661 r1706  
    4141void TextRender::Init()
    4242{
    43     m_font = new TileSet("tools/neercs/video/resource/charset_p0t-noodle.png",
     43    m_font = new TileSet("tools/neercs/video/resource/charset_dos.png",
    4444                         ivec2(256, 256), ivec2(1));
    4545
Note: See TracChangeset for help on using the changeset viewer.