Changeset 2049 for trunk/tools


Ignore:
Timestamp:
Oct 29, 2012, 2:02:43 AM (7 years ago)
Author:
rez
Message:

neercs: added theme support + 2 new themes [F4/F5 to switch]

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

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/postfx.lolfx

    r2039 r2049  
    2121uniform vec4 ghost2;
    2222uniform vec4 glass;
     23uniform vec3 gradient;
     24uniform vec3 gradient_color;
    2325uniform float vignetting;
    2426uniform float aberration;
     
    7274    c+=vec3(ca1.x,c.y,ca2.z);                                // chromatic aberration
    7375
    74     vec3 c1=vec3(0.8,0.8,0.8);
    75     vec3 c2=vec3(0.0,0.0,0.0);
     76    vec3 c1=vec3(gradient_color.x,gradient_color.y,gradient_color.z);
     77    vec3 c2=vec3(gradient_color.x,gradient_color.y,gradient_color.z)/4;
    7678    vec3 c3=vec3(1.0,1.0,1.0);
    77     vec3 c4=vec3(0.8,0.8,0.8);
    78     vec3 c5=vec3(0.0,0.0,0.0);
     79    vec3 c4=vec3(gradient_color.z,gradient_color.y,gradient_color.x);
     80    vec3 c5=vec3(gradient_color.z,gradient_color.y,gradient_color.x)/4;
    7981    vec3 r;
    80     float r_p=0.5;
    81     float r_h=0.05;
     82    float r_p=gradient.x;
     83    float r_h=gradient.y;
     84    float r_h2=gradient.y/2;
    8285    float k=z.y+1.0;
    8386
    84     if(k<=r_p-r_h) r=mix(c1,c2,k*(1/(r_p-r_h)));
    85     if(k>r_p-r_h&&k<=r_p) r=mix(c2,c3,(k-(r_p-r_h))*(1/r_h));
     87    if(k<=r_p-r_h2) r=mix(c1,c2,k*(1/(r_p-r_h2)));
     88    if(k>r_p-r_h2&&k<=r_p) r=mix(c2,c3,(k-(r_p-r_h2))*(1/r_h2));
    8689    if(k>r_p&&k<r_p+r_h) r=mix(c3,c4,(k-r_p)*(1/r_h));
    8790    if(k>=r_p+r_h) r=mix(c4,c5,k*((k-(r_p+r_h))/(r_p-r_h)));
     
    9194    c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)/ratio_2d.y); // scanline h
    9295    c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)/ratio_2d.x); // scanline v
    93     c+=r*0.05;                                               // reflection
     96    c+=r*gradient.z;                                         // gradient
    9497    c*=mix(1.0,mask,vignetting);                             // vignetting
    9598    c*=letterbox(z,corner.x+2.0,corner.y,corner.z);          // corner
  • trunk/tools/neercs/video/render.cpp

    r2047 r2049  
    9393float value, angle, radius, scale, speed;
    9494/* text variable */
    95 ivec2 map_size(256,256);        // texture map size
    96 ivec2 canvas_char(0,0);         // canvas char number
    97 ivec2 canvas_size(0,0);         // caca size
    98 ivec2 font_size(8,8);           // font size
    99 ivec2 ratio_2d(1,1);            // 2d ratio
    100 ivec2 border(0,0);              // border width
     95ivec2 map_size(256,256);   // texture map size
     96ivec2 canvas_char(0,0);    // canvas char number
     97ivec2 canvas_size(0,0);    // caca size
     98ivec2 font_size(8,8);      // font size
     99ivec2 ratio_2d(1,1);       // 2d ratio
     100ivec2 border(0,0);         // border width
    101101/* shader variable */
    102 vec2 buffer(1.0f,0.0f);         // [new frame mix,old frame mix]
    103 vec2 remanence(0.0f,0.0f);      // remanence [source mix,buffer mix]
    104 vec2 glow_mix(0.5f,0.0f);       // glow mix [source mix,glow mix]
    105 vec2 glow_large(0.0f,0.0f);     // large glow radius [center,corner]
    106 vec2 glow_small(0.0f,0.0f);     // small glow radius [center,corner]
    107 vec2 blur(0.0f,0.0f);           // blur radius [center,corner]
    108 vec4 copper_copper(0.75f,0.25f,0.42f,4.0f);     // copper [base,variable,repeat,color cycle]
    109 vec3 copper_mask_color(4.0f,4.0f,4.0f);         // color [red,green,blue]
    110 vec3 color_filter(1.0f,1.0f,1.0f);              // color filter [red,green,blue]
    111 vec4 color_color(1.0f,1.0f,0.0f,0.0f);          // color modifier [brightness,contrast,level,grayscale]
    112 vec2 noise_offset(0.0f,0.0f);                   // random line [horizontal,vertical]
    113 float noise_noise = 0.0f;                       // noise
    114 vec3 noise_retrace(0.0f,0.0f,0.0f);             // retrace [strength,length,speed]
    115 vec2 postfx_deform(0.0f,0.5f);                  // deformation [ratio,zoom]
    116 float postfx_vignetting = 0.0f;                 // vignetting strength
    117 float postfx_aberration = 0.0f;                 // chromatic aberration
    118 vec4 postfx_ghost1(0.0f,0.0f,0.0f,0.0f);        // ghost picture 1 [position x,position y,position z,strength]
    119 vec4 postfx_ghost2(0.0f,0.0f,0.0f,0.0f);        // ghost picture 2 [position x,position y,position z,strength]
    120 vec4 postfx_glass(8.0f,0.0f,0.0f,0.0f);         // glass [depth,thickness,strength,deform ratio]
    121 vec4 postfx_moire_h(1.0f,0.0f,0.0f,0.0f);       // vertical moire [base,variable,repeat,shift]
    122 vec4 postfx_moire_v(1.0f,0.0f,0.0f,0.0f);       // horizontal moire [base,variable,repeat,shift]
    123 vec4 postfx_scanline_h(1.0f,0.0f,0.0f,0.0f);    // vertical scanline [base,variable,repeat,shift]
    124 vec4 postfx_scanline_v(1.0f,0.0f,0.0f,0.0f);    // horizontal scanline [base,variable,repeat,shift]
    125 vec3 postfx_corner(0.0f,1.0f,1.0f);             // corner [width,radius,blur]
    126 vec4 mirror(0.0f,0.0f,0.0f,1.0f);               // mirror [width,height,strength,ratio]
    127 vec4 radial(4.0f,0.9f,16,0.0f);                 // radial [distance,fade ratio,iteration,strength]
     102vec2 buffer;               // [new frame mix,old frame mix]
     103vec2 remanence;            // remanence [source mix,buffer mix]
     104vec2 glow_mix;             // glow mix [source mix,glow mix]
     105vec2 glow_large;           // large glow radius [center,corner]
     106vec2 glow_small;           // small glow radius [center,corner]
     107vec2 blur;                 // blur radius [center,corner]
     108vec4 copper_copper;        // copper [base,variable,repeat,color cycle]
     109vec3 copper_mask_color;    // color [red,green,blue]
     110vec3 color_filter;         // color filter [red,green,blue]
     111vec4 color_color;          // color modifier [brightness,contrast,level,grayscale]
     112vec2 noise_offset;         // random line [horizontal,vertical]
     113float noise_noise;         // noise
     114vec3 noise_retrace;        // retrace [strength,length,speed]
     115vec2 postfx_deform;        // deformation [ratio,zoom]
     116float postfx_vignetting;   // vignetting strength
     117float postfx_aberration;   // chromatic aberration
     118vec4 postfx_ghost1;        // ghost picture 1 [position x,position y,position z,strength]
     119vec4 postfx_ghost2;        // ghost picture 2 [position x,position y,position z,strength]
     120vec3 postfx_gradient;      // gradient [position y,height,strength]
     121vec3 postfx_gradient_color;// gradient color [red,green,blue]
     122vec4 postfx_glass;         // glass [depth,thickness,strength,deform ratio]
     123vec4 postfx_moire_h;       // vertical moire [base,variable,repeat,shift]
     124vec4 postfx_moire_v;       // horizontal moire [base,variable,repeat,shift]
     125vec4 postfx_scanline_h;    // vertical scanline [base,variable,repeat,shift]
     126vec4 postfx_scanline_v;    // horizontal scanline [base,variable,repeat,shift]
     127vec3 postfx_corner;        // corner [width,radius,blur]
     128vec4 mirror;               // mirror [width,height,strength,ratio]
     129vec4 radial;               // radial [distance,fade ratio,iteration,strength]
    128130/* theme variable */
    129 int theme_i = 1;                // current theme
    130 const int theme_n = 2;          // theme number
     131int theme_i = 0;           // current theme
     132const int theme_n = 4;     // theme number
     133int theme_var_key = 0;     // theme array key
    131134/* setup variable */
    132135bool setup_switch = false;      // switch [option/item]
     
    135138int setup_cursor = 0;           // cursor position
    136139int setup_option_i = 0;         // selected option
    137 const int setup_option_n = 14;  // option number
     140const int setup_option_n = 15;  // option number
    138141int setup_option_p = 0;         // option position
    139142int setup_item_i = 0;           // selected item
     
    141144int setup_item_p = 0;           // item position
    142145int setup_item_key = 0;         // item array key
    143 ivec3 setup_size(29,9,12);      // size [w,h,split]
     146ivec3 setup_size(29, 9, 12);    // size [w,h,split]
    144147ivec2 setup_canvas_size(ivec2(setup_size.x + 1, setup_size.y + 1) * font_size * ivec2(2,4));
    145 ivec2 setup_color(0xaaa,0x222); // color [foreground,background] 0x678,0x234
     148ivec2 setup_color(0xaaa, 0x222);// color [foreground,background] 0x678,0x234
    146149char const *setup_text[]={
    147150    "main",
     
    226229        "front z",
    227230        "front strength",
     231    "gradient",
     232        "position",
     233        "thickness",
     234        "strength",
     235        "color r",
     236        "color g",
     237        "color b",
     238        "",
     239        "",
    228240    "glass",
    229241        "depth",
     
    273285    };
    274286
    275 vec4 setup_var[]={ // setup variable [start,end,step,value]
     287vec4 setup_conf[]={ // setup variable [start,end,step,value]
    276288vec4(0), /* main */
    277     vec4(1,  8, 1, ratio_2d.x),
    278     vec4(1,  8, 1, ratio_2d.y),
    279     vec4(0, 16, 1, border.x),
    280     vec4(0, 16, 1, border.y),
     289    vec4(1,  8, 1, 0), // ratio_2d.x
     290    vec4(1,  8, 1, 0), // ratio_2d.y
     291    vec4(0, 16, 1, 0), // border.x
     292    vec4(0, 16, 1, 0), // border.y
    281293    vec4(0),
    282294    vec4(0),
     
    285297vec4(0), /* remanence */
    286298    vec4(0, 1, 1, 1),
    287     vec4(0.0f, 1.0f, 0.1f, buffer.x),
    288     vec4(0.0f, 1.0f, 0.1f, buffer.y),
    289     vec4(0.0f, 1.0f, 0.1f, remanence.x),
    290     vec4(0.0f, 1.0f, 0.1f, remanence.y),
     299    vec4(0.0f, 1.0f, 0.1f, 0), // buffer.x
     300    vec4(0.0f, 1.0f, 0.1f, 0), // buffer.y
     301    vec4(0.0f, 1.0f, 0.1f, 0), // remanence.x
     302    vec4(0.0f, 1.0f, 0.1f, 0), // remanence.y
    291303    vec4(0),
    292304    vec4(0),
     
    294306vec4(0), /* glow */
    295307    vec4(0, 1, 1, 1),
    296     vec4(0.0f, 1.0f, 0.1f, glow_mix.x),
    297     vec4(0.0f, 1.0f, 0.1f, glow_mix.y),
    298     vec4(0.0f, 4.0f, 0.1f, glow_large.x),
    299     vec4(0.0f, 4.0f, 0.1f, glow_large.y),
    300     vec4(0.0f, 2.0f, 0.1f, glow_small.x),
    301     vec4(0.0f, 2.0f, 0.1f, glow_small.y),
     308    vec4(0.0f, 1.0f, 0.1f, 0), // glow_mix.x
     309    vec4(0.0f, 1.0f, 0.1f, 0), // glow_mix.y
     310    vec4(0.0f, 4.0f, 0.1f, 0), // glow_large.x
     311    vec4(0.0f, 4.0f, 0.1f, 0), // glow_large.y
     312    vec4(0.0f, 2.0f, 0.1f, 0), // glow_small.x
     313    vec4(0.0f, 2.0f, 0.1f, 0), // glow_small.y
    302314    vec4(0),
    303315vec4(0), /* blur */
    304316    vec4(0, 1, 1, 1),
    305     vec4(0, 2, 0.05f, blur.x),
    306     vec4(0, 2, 0.05f, blur.y),
     317    vec4(0, 2, 0.05f, 0), // blur.x
     318    vec4(0, 2, 0.05f, 0), // blur.y
    307319    vec4(0),
    308320    vec4(0),
     
    312324vec4(0), /* screen */
    313325    vec4(0, 1, 1, 1),
    314     vec4(0.0f, 1.0f, 0.05f, postfx_deform.x),
    315     vec4(0.2f, 0.7f, 0.01f, postfx_deform.y),
    316     vec4(0.0f, 4.0f, 0.10f, postfx_corner.x),
    317     vec4(0.0f, 1.0f, 0.05f, postfx_corner.y),
    318     vec4(0.8f, 1.0f, 0.01f, postfx_corner.z),
    319     vec4(0.0f, 1.0f, 0.10f, postfx_vignetting),
     326    vec4(0.0f, 1.0f, 0.05f, 0), // postfx_deform.x
     327    vec4(0.2f, 0.7f, 0.01f, 0), // postfx_deform.y
     328    vec4(0.0f, 4.0f, 0.10f, 0), // postfx_corner.x
     329    vec4(0.0f, 1.0f, 0.05f, 0), // postfx_corner.y
     330    vec4(0.8f, 1.0f, 0.01f, 0), // postfx_corner.z
     331    vec4(0.0f, 1.0f, 0.10f, 0), // postfx_vignetting
    320332    vec4(0),
    321333vec4(0), /* copper */
    322334    vec4(0, 1, 1, 1),
    323     vec4(0.0f, 1.0f, 0.05f, copper_copper.x),
    324     vec4(0.0f, 1.0f, 0.05f, copper_copper.y),
    325     vec4(0.0f, 1.0f, 0.02f, copper_copper.z),
    326     vec4(1.0f, 8.0f, 0.25f, copper_copper.w),
    327     vec4(0.0f, 4.0f, 0.25f, copper_mask_color.x),
    328     vec4(0.0f, 4.0f, 0.25f, copper_mask_color.y),
    329     vec4(0.0f, 4.0f, 0.25f, copper_mask_color.z),
     335    vec4(0.0f, 1.0f, 0.05f, 0), // copper_copper.x
     336    vec4(0.0f, 1.0f, 0.05f, 0), // copper_copper.y
     337    vec4(0.0f, 1.0f, 0.02f, 0), // copper_copper.z
     338    vec4(1.0f, 8.0f, 0.25f, 0), // copper_copper.w
     339    vec4(0.0f, 4.0f, 0.25f, 0), // copper_mask_color.x
     340    vec4(0.0f, 4.0f, 0.25f, 0), // copper_mask_color.y
     341    vec4(0.0f, 4.0f, 0.25f, 0), // copper_mask_color.z
    330342vec4(0), /* color */
    331     vec4( 0.0f, 1.0f, 0.05f, color_filter.x),
    332     vec4( 0.0f, 1.0f, 0.05f, color_filter.y),
    333     vec4( 0.0f, 1.0f, 0.05f, color_filter.z),
    334     vec4( 0.0f, 2.0f, 0.05f, color_color.x),
    335     vec4( 0.0f, 2.0f, 0.05f, color_color.y),
    336     vec4(-1.0f, 1.0f, 0.05f, color_color.z),
    337     vec4( 0.0f, 1.0f, 0.05f, color_color.w),
    338     vec4( 0.0f, 8.0f, 0.50f, postfx_aberration),
     343    vec4( 0.0f, 1.0f, 0.05f, 0), // color_filter.x
     344    vec4( 0.0f, 1.0f, 0.05f, 0), // color_filter.y
     345    vec4( 0.0f, 1.0f, 0.05f, 0), // color_filter.z
     346    vec4( 0.0f, 2.0f, 0.05f, 0), // color_color.x
     347    vec4( 0.0f, 2.0f, 0.05f, 0), // color_color.y
     348    vec4(-1.0f, 1.0f, 0.05f, 0), // color_color.z
     349    vec4( 0.0f, 1.0f, 0.05f, 0), // color_color.w
     350    vec4( 0.0f, 8.0f, 0.50f, 0), // postfx_aberration
    339351vec4(0), /* noise */
    340352    vec4(0, 1, 1, 1),
    341     vec4(0.0f, 4.0f, 0.50f, noise_offset.x),
    342     vec4(0.0f, 4.0f, 0.50f, noise_offset.y),
    343     vec4(0.0f, 0.5f, 0.05f, noise_noise),
    344     vec4(0.0f, 4.0f, 0.25f, noise_retrace.x),
    345     vec4(0.0f, 8.0f, 0.50f, noise_retrace.y),
    346     vec4(0.0f, 4.0f, 0.25f, noise_retrace.z),
     353    vec4(0.0f, 4.0f, 0.50f, 0), // noise_offset.x
     354    vec4(0.0f, 4.0f, 0.50f, 0), // noise_offset.y
     355    vec4(0.0f, 0.5f, 0.05f, 0), // noise_noise
     356    vec4(0.0f, 4.0f, 0.25f, 0), // noise_retrace.x
     357    vec4(0.0f, 8.0f, 0.50f, 0), // noise_retrace.y
     358    vec4(0.0f, 4.0f, 0.25f, 0), // noise_retrace.z
    347359    vec4(0),
    348360vec4(0), /* ghost */
    349     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost1.x),
    350     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost1.y),
    351     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost1.z),
    352     vec4(-1.0f, 1.0f, 0.05f, postfx_ghost1.w),
    353     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost2.x),
    354     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost2.y),
    355     vec4(-2.0f, 2.0f, 0.10f, postfx_ghost2.z),
    356     vec4(-1.0f, 1.0f, 0.05f, postfx_ghost2.w),
     361    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost1.x
     362    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost1.y
     363    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost1.z
     364    vec4(-1.0f, 1.0f, 0.05f, 0), // postfx_ghost1.w
     365    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost2.x
     366    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost2.y
     367    vec4(-2.0f, 2.0f, 0.10f, 0), // postfx_ghost2.z
     368    vec4(-1.0f, 1.0f, 0.05f, 0), // postfx_ghost2.w
     369vec4(0), /* gradient */
     370    vec4( 0.0f, 1.0f, 0.05f, 0), // postfx_gradient.x
     371    vec4( 0.0f, 0.5f, 0.05f, 0), // postfx_gradient.y
     372    vec4(-0.5f, 0.5f, 0.05f, 0), // postfx_gradient.z
     373    vec4( 0.0f, 1.0f, 0.05f, 0), // postfx_gradient_color.x
     374    vec4( 0.0f, 1.0f, 0.05f, 0), // postfx_gradient_color.y
     375    vec4( 0.0f, 1.0f, 0.05f, 0), // postfx_gradient_color.z
     376    vec4(0),
     377    vec4(0),
    357378vec4(0), /* glass */
    358     vec4(0.0f, 16.0f, 0.50f, postfx_glass.x),
    359     vec4(0.0f,  1.0f, 0.05f, postfx_glass.y),
    360     vec4(0.0f,  2.0f, 0.05f, postfx_glass.z),
    361     vec4(0.0f,  1.0f, 0.05f, postfx_glass.w),
     379    vec4(0.0f, 16.0f, 0.50f, 0), // postfx_glass.x
     380    vec4(0.0f,  1.0f, 0.05f, 0), // postfx_glass.y
     381    vec4(0.0f,  2.0f, 0.05f, 0), // postfx_glass.z
     382    vec4(0.0f,  1.0f, 0.05f, 0), // postfx_glass.w
    362383    vec4(0),
    363384    vec4(0),
     
    365386    vec4(0),
    366387vec4(0), /* moire */
    367     vec4( 0.5f, 1.0f, 0.05f, postfx_moire_h.x),
    368     vec4(-0.5f, 0.5f, 0.05f, postfx_moire_h.y),
    369     vec4( 0.0f, 4.0f, 0.50f, postfx_moire_h.z),
    370     vec4( 0.0f, 4.0f, 0.50f, postfx_moire_h.w),
    371     vec4( 0.5f, 1.0f, 0.05f, postfx_moire_v.x),
    372     vec4(-0.5f, 0.5f, 0.05f, postfx_moire_v.y),
    373     vec4( 0.0f, 4.0f, 0.50f, postfx_moire_v.z),
    374     vec4( 0.0f, 4.0f, 0.50f, postfx_moire_v.w),
     388    vec4( 0.5f, 1.0f, 0.05f, 0), // postfx_moire_h.x
     389    vec4(-0.5f, 0.5f, 0.05f, 0), // postfx_moire_h.y
     390    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_moire_h.z
     391    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_moire_h.w
     392    vec4( 0.5f, 1.0f, 0.05f, 0), // postfx_moire_v.x
     393    vec4(-0.5f, 0.5f, 0.05f, 0), // postfx_moire_v.y
     394    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_moire_v.z
     395    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_moire_v.w
    375396vec4(0), /* scanline */
    376     vec4( 0.5f, 1.0f, 0.05f, postfx_scanline_h.x),
    377     vec4(-0.5f, 0.5f, 0.05f, postfx_scanline_h.y),
    378     vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_h.z),
    379     vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_h.w),
    380     vec4( 0.5f, 1.0f, 0.05f, postfx_scanline_v.x),
    381     vec4(-0.5f, 0.5f, 0.05f, postfx_scanline_v.y),
    382     vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_v.z),
    383     vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_v.w),
     397    vec4( 0.5f, 1.0f, 0.05f, 0), // postfx_scanline_h.x
     398    vec4(-0.5f, 0.5f, 0.05f, 0), // postfx_scanline_h.y
     399    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_scanline_h.z
     400    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_scanline_h.w
     401    vec4( 0.5f, 1.0f, 0.05f, 0), // postfx_scanline_v.x
     402    vec4(-0.5f, 0.5f, 0.05f, 0), // postfx_scanline_v.y
     403    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_scanline_v.z
     404    vec4( 0.0f, 4.0f, 0.50f, 0), // postfx_scanline_v.w
    384405vec4(0), /* mirror */
    385406    vec4(0, 1, 1, 1),
    386     vec4(0.0f, 2.0f, 0.05f, mirror.x),
    387     vec4(0.0f, 2.0f, 0.05f, mirror.y),
    388     vec4(0.0f, 1.0f, 0.05f, mirror.z),
    389     vec4(1.0f, 8.0f, 1.00f, mirror.w),
     407    vec4(0.0f, 2.0f, 0.05f, 0), // mirror.x
     408    vec4(0.0f, 2.0f, 0.05f, 0), // mirror.y
     409    vec4(0.0f, 1.0f, 0.05f, 0), // mirror.z
     410    vec4(1.0f, 8.0f, 1.00f, 0), // mirror.w
    390411    vec4(0),
    391412    vec4(0),
     
    393414vec4(0), /* radial blur */
    394415    vec4(0, 1, 1, 1),
    395     vec4(2.0f, 8.0f, 0.25f, radial.x),
    396     vec4(0.8f, 1.0f, 0.01f, radial.y),
    397     vec4(2.0f,32.0f, 2.00f, radial.z),
    398     vec4(0.0f, 1.0f, 0.05f, radial.w),
     416    vec4(2.0f, 8.0f, 0.25f, 0), // radial.x
     417    vec4(0.8f, 1.0f, 0.01f, 0), // radial.y
     418    vec4(2.0f,32.0f, 2.00f, 0), // radial.z
     419    vec4(0.0f, 1.0f, 0.05f, 0), // radial.w
    399420    vec4(0),
    400421    vec4(0),
     
    448469    0.0f,0.0f,0.0f,0.0f,      // postfx_ghost2
    4494700,
     471    0.5f,0.0f,0.0f ,          // postfx_gradient
     472    0.0f,0.0f,0.0f,           // postfx_gradient_color
     473    0,0,
     4740,
    450475    8.0f,0.0f,0.0f,0.0f,      // postfx_glass
    451476    0,0,0,0,
     
    4624870,
    463488    1,                        // m_shader_radial
    464     4.0f,0.9f,16,0.0f,        // radial
     489    4.0f,0.9f,1,0.0f,         // radial
    465490    0,0,0,
    466     /* crt */
     491/* crt */
     4920,
    467493    2,3,                      // ratio_2d
    468494    2,1,                      // border
     495    0,0,0,0,
     4960,
     497    1,                        // m_shader_remanence
    469498    0.2f,0.8f,                // buffer
    470499    0.6f,0.4f,                // remanence
     500    0,0,0,
     5010,
     502    1,                        // m_shader_glow
    471503    0.7f,0.3f,                // glow_mix
    472504    3.0f,0.0f,                // glow_large
    473505    1.5f,0.0f,                // glow_small
     506    0,
     5070,
     508    1,                        // m_shader_blur
    474509    0.5f,0.0f,                // blur
     510    0,0,0,0,0,
     5110,
     512    1,                        // m_shader_postfx
    475513    0.8f,0.48f,               // postfx_deform
    476514    0.0f,0.8f,0.96f,          // postfx_corner
    477515    0.5f,                     // postfx_vignetting
     516    0,
     5170,
     518    1,                        // m_shader_copper
    478519    0.75f,0.25f,0.42f,4.0f,   // copper_copper
    479520    4.0f,4.0f,4.0f,           // copper_mask_color
     5210,
    480522    0.9f,0.95f,0.85f,         // color_filter
    481523    1.0f,1.25f,0.1f,0.4f,     // color_color
    482524    4.0f,                     // postfx_aberration
     5250,
     526    1,                        // m_shader_noise
    483527    1.0f,1.0f,                // noise_offset
    484528    0.15f,                    // noise_noise
    485529    1.0f,1.0f,0.5f,           // noise_retrace
     530    0,
     5310,
    486532    1.0f,0.0f,0.0f,-0.25f,    // postfx_ghost1
    487533    1.5f,0.0f,0.0f,0.25f,     // postfx_ghost2
     5340,
     535    0.5f,0.25f,0.05f,         // postfx_gradient
     536    0.9f,0.8f,0.5f,           // postfx_gradient_color
     537    0,0,
     5380,
    488539    8.0f,0.25f,0.75f,0.2f,    // postfx_glass
     540    0,0,0,0,
     5410,
    489542    0.75f,-0.25f,0.0f,1.0f,   // postfx_moire_h
    490543    0.75f,-0.25f,1.0f,2.0f,   // postfx_moire_v
     5440,
    491545    1.0f,0.0f,0.0f,0.0f,      // postfx_scanline_h
    492546    0.75f,-0.25f,2.0f,0.0f,   // postfx_scanline_v
    493     0.95f,0.9f,0.4f,4.0f,     // mirror
     5470,
     548    1,                        // m_shader_mirror
     549    0.95f,0.9f,0.5f,4.0f,     // mirror
     550    0,0,0,
     5510,
     552    1,                        // m_shader_radial
    494553    4.0f,0.9f,16,0.25f,       // radial
    495     /* green screen */
    496     /* granpa tv */
    497     0.0f
    498     };
    499 
    500 void Render::InitVar()
     554    0,0,0,
     555/* green screen */
     5560,
     557    2,4,                      // ratio_2d
     558    1,0,                      // border
     559    0,0,0,0,
     5600,
     561    1,                        // m_shader_remanence
     562    0.2f,0.8f,                // buffer
     563    0.6f,0.4f,                // remanence
     564    0,0,0,
     5650,
     566    1,                        // m_shader_glow
     567    0.4f,0.6f,                // glow_mix
     568    4.0f,0.0f,                // glow_large
     569    2.0f,0.0f,                // glow_small
     570    0,
     5710,
     572    1,                        // m_shader_blur
     573    0.5f,0.0f,                // blur
     574    0,0,0,0,0,
     5750,
     576    1,                        // m_shader_postfx
     577    0.7f,0.5f,                // postfx_deform
     578    0.0f,0.85f,0.98f,         // postfx_corner
     579    0.5f,                     // postfx_vignetting
     580    0,
     5810,
     582    1,                        // m_shader_copper
     583    0.75f,0.25f,0.42f,4.0f,   // copper_copper
     584    4.0f,4.0f,4.0f,           // copper_mask_color
     5850,
     586    1.0f,0.75f,0.0f,          // color_filter
     587    1.0f,1.25f,0.2f,1.0f,     // color_color
     588    1.5f,                     // postfx_aberration
     5890,
     590    1,                        // m_shader_noise
     591    1.0f,0.0f,                // noise_offset
     592    0.25f,                    // noise_noise
     593    1.0f,2.0f,2.0f,           // noise_retrace
     594    0,
     5950,
     596    1.0f,0.0f,0.0f,-0.25f,    // postfx_ghost1
     597    1.5f,0.0f,0.0f,0.25f,     // postfx_ghost2
     5980,
     599    0.5f,0.15f,0.05f,         // postfx_gradient
     600    0.8f,0.8f,0.8f,           // postfx_gradient_color
     601    0,0,
     6020,
     603    8.0f,0.0f,0.0f,0.0f,      // postfx_glass
     604    0,0,0,0,
     6050,
     606    1.0f,0.0f,0.0f,0.0f,      // postfx_moire_h
     607    1.0f,0.0f,0.0f,0.0f,      // postfx_moire_v
     6080,
     609    0.6f,0.4f,3.5f,0.0f,      // postfx_scanline_h
     610    0.9f,0.1f,2.5f,0.0f,      // postfx_scanline_v
     6110,
     612    1,                        // m_shader_mirror
     613    0.6f,0.6f,0.5f,4.0f,      // mirror
     614    0,0,0,
     6150,
     616    1,                        // m_shader_radial
     617    4.0f,0.84f,16,0.25f,      // radial
     618    0,0,0,
     619/* lcd */
     6200,
     621    2,2,                      // ratio_2d
     622    1,1,                      // border
     623    0,0,0,0,
     6240,
     625    1,                        // m_shader_remanence
     626    0.2f,0.8f,                // buffer
     627    0.2f,0.8f,                // remanence
     628    0,0,0,
     6290,
     630    1,                        // m_shader_glow
     631    0.6f,0.4f,                // glow_mix
     632    3.0f,0.0f,                // glow_large
     633    1.5f,0.0f,                // glow_small
     634    0,
     6350,
     636    1,                        // m_shader_blur
     637    0.25f,0.0f,               // blur
     638    0,0,0,0,0,
     6390,
     640    1,                        // m_shader_postfx
     641    0.0f,0.5f,                // postfx_deform
     642    0.0f,1.0f,1.0f,           // postfx_corner
     643    0.0f,                     // postfx_vignetting
     644    0,
     6450,
     646    1,                        // m_shader_copper
     647    0.75f,0.25f,0.42f,4.0f,   // copper_copper
     648    4.0f,4.0f,4.0f,           // copper_mask_color
     6490,
     650    1.0f,1.0f,0.9f,           // color_filter
     651    0.9f,1.1f,0.1f,0.0f,      // color_color
     652    3.0f,                     // postfx_aberration
     6530,
     654    1,                        // m_shader_noise
     655    0.0f,0.0f,                // noise_offset
     656    0.15f,                    // noise_noise
     657    0.0f,0.0f,0.0f,           // noise_retrace
     658    0,
     6590,
     660    0.0f,0.0f,0.0f,0.0f,      // postfx_ghost1
     661    0.0f,0.0f,0.0f,0.0f,      // postfx_ghost2
     6620,
     663    0.5f,0.0f,0.0f ,          // postfx_gradient
     664    0.0f,0.0f,0.0f,           // postfx_gradient_color
     665    0,0,
     6660,
     667    8.0f,0.0f,0.0f,0.0f,      // postfx_glass
     668    0,0,0,0,
     6690,
     670    1.0f,0.0f,0.0f,0.0f,      // postfx_moire_h
     671    1.0f,0.0f,0.0f,0.0f,      // postfx_moire_v
     6720,
     673    0.85f,0.15f,2.0f,0.0f,    // postfx_scanline_h
     674    0.85f,0.15f,2.0f,0.0f,    // postfx_scanline_v
     6750,
     676    1,                        // m_shader_mirror
     677    0.0f,0.0f,0.0f,1.0f,      // mirror
     678    0,0,0,
     6790,
     680    1,                        // m_shader_radial
     681    4.0f,0.9f,1,0.0f,         // radial
     682    0,0,0,
     683/* granpa tv */
     684/* intex system 4000 */
     6850};
     686
     687void Render::InitShaderVar()
    501688{
    502     int k = theme_i * setup_option_n * 8 + 1; /* main */
     689    int k = theme_i * setup_option_n * 9 + 1; /* main */
    503690    ratio_2d = vec2(theme_var[k], theme_var[k + 1]); k += 2;
    504691    border = vec2(theme_var[k], theme_var[k + 1]); k += 2;
     
    536723    postfx_ghost1 = vec4(theme_var[k], theme_var[k + 1], theme_var[k + 2], theme_var[k + 3]); k += 4;
    537724    postfx_ghost2 = vec4(theme_var[k], theme_var[k + 1], theme_var[k + 2], theme_var[k + 3]); k += 4;
    538     k += 1; /* glass */
     725    k += 1; /* gradient */
     726    postfx_gradient = vec3(theme_var[k], theme_var[k + 1], theme_var[k + 2]); k += 3;
     727    postfx_gradient_color = vec3(theme_var[k], theme_var[k + 1], theme_var[k + 2]); k += 3;
     728    k += 3; /* glass */
    539729    postfx_glass = vec4(theme_var[k], theme_var[k + 1], theme_var[k + 2], theme_var[k + 3]); k += 4;
    540730    k += 5; /* moire */
     
    550740    m_shader_radial = (theme_var[k] == 1) ? true : false; k++;
    551741    radial = vec4(theme_var[k], theme_var[k + 1], theme_var[k + 2], theme_var[k + 3]); k += 4;
    552 }
    553 
    554 void Render::SetupVar()
    555 {
    556 }
    557 
    558 void Render::UpdateVar()
    559 {
    560     int k = 1; /* main */
    561     ratio_2d = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    562     border = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    563     k += 5; /* remanence */
    564     m_shader_remanence = (setup_var[k].w == 1) ? true : false; k++;
    565     buffer = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    566     remanence = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    567     k += 4; /* glow */
    568     m_shader_glow = (setup_var[k].w == 1) ? true : false; k++;
    569     glow_mix = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    570     glow_large = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    571     glow_small = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    572     k += 2; /* blur */
    573     m_shader_blur = (setup_var[k].w == 1) ? true : false; k++;
    574     blur = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    575     k += 6; /* screen */
    576     m_shader_postfx = (setup_var[k].w == 1) ? true : false; k++;
    577     postfx_deform = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    578     postfx_corner = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    579     postfx_vignetting = setup_var[k].w; k++;
    580     k += 2; /* copper */
    581     m_shader_copper = (setup_var[k].w == 1) ? true : false; k++;
    582     copper_copper = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    583     copper_mask_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    584     k += 1; /* color */
    585     color_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    586     color_color = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    587     postfx_aberration = setup_var[k].w; k++;
    588     k += 1; /* noise */
    589     m_shader_noise = (setup_var[k].w == 1) ? true : false; k++;
    590     noise_offset = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    591     noise_noise = setup_var[k].w; k++;
    592     noise_retrace = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    593     k += 2; /* ghost */
    594     postfx_ghost1 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    595     postfx_ghost2 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    596     k += 1; /* glass */
    597     postfx_glass = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    598     k += 5; /* moire */
    599     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;
    600     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;
    601     k += 1; /* scanline */
    602     postfx_scanline_h = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    603     postfx_scanline_v = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    604     k += 1; /* mirror */
    605     m_shader_mirror = (setup_var[k].w == 1) ? true : false; k++;
    606     mirror = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    607     k += 4; /* radial blur */
    608     m_shader_radial = (setup_var[k].w == 1) ? true : false; k++;
    609     radial = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    610742}
    611743
     
    676808              shader_postfx_glass,
    677809              shader_postfx_vignetting,
     810              shader_postfx_gradient,
     811              shader_postfx_gradient_color,
    678812              shader_postfx_aberration,
    679813              shader_postfx_moire_h,
     
    776910    shader_postfx_ghost2 = shader_postfx->GetUniformLocation("ghost2");
    777911    shader_postfx_glass = shader_postfx->GetUniformLocation("glass");
     912    shader_postfx_gradient = shader_postfx->GetUniformLocation("gradient");
     913    shader_postfx_gradient_color = shader_postfx->GetUniformLocation("gradient_color");
    778914    shader_postfx_vignetting = shader_postfx->GetUniformLocation("vignetting");
    779915    shader_postfx_aberration = shader_postfx->GetUniformLocation("aberration");
     
    802938int Render::CreateGLWindow()
    803939{
    804     InitVar();
    805     SetupVar();
    806     UpdateVar();
     940    InitShaderVar();
    807941    UpdateSize();
    808942    InitDraw();
     
    8891023        int y = setup_size.y;
    8901024        setup_item_key = setup_option_i * (setup_item_n + 1) + 1 + setup_item_i;
     1025        theme_var_key = theme_i * setup_option_n * 9 + setup_item_key;
    8911026        caca_set_color_argb(m_cv_setup, setup_color.y, setup_color.x);
    8921027        caca_draw_line(m_cv_setup, 0, y, setup_size.x, y,' ');
     
    8951030            int x = 1;
    8961031            int w = setup_size.x - 3 - 4;
    897             float bar_w = w / (setup_var[setup_item_key].y - setup_var[setup_item_key].x);
    898             int bar_x = bar_w * setup_var[setup_item_key].x;
    899             if ((setup_var[setup_item_key].y - setup_var[setup_item_key].x) / setup_var[setup_item_key].z > 1)
     1032            float bar_w = w / (setup_conf[setup_item_key].y - setup_conf[setup_item_key].x);
     1033            int bar_x = bar_w * setup_conf[setup_item_key].x;
     1034            if ((setup_conf[setup_item_key].y - setup_conf[setup_item_key].x) / setup_conf[setup_item_key].z > 1)
    9001035            {
    901                 /* Work around a bug in libcaca */
    902                 if (setup_size.x - 4 < caca_get_canvas_width(m_cv_setup)) caca_printf(m_cv_setup, setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
    903                 caca_draw_line(m_cv_setup, x, y, x - bar_x + int(bar_w * setup_var[setup_item_key].y), y,'.');
    904                 if (setup_var[setup_item_key].w != setup_var[setup_item_key].x) caca_draw_line(m_cv_setup, x, y, x - bar_x + int(bar_w * setup_var[setup_item_key].w), y, 'x');
     1036                /* work around a bug in libcaca */
     1037                if (setup_size.x - 4 < caca_get_canvas_width(m_cv_setup)) caca_printf(m_cv_setup, setup_size.x - 4, y, "%4.2f", theme_var[theme_var_key]);
     1038                caca_draw_line(m_cv_setup, x, y, x - bar_x + int(bar_w * setup_conf[setup_item_key].y), y,'.');
     1039                if (theme_var[theme_var_key] != setup_conf[setup_item_key].x) caca_draw_line(m_cv_setup, x, y, x - bar_x + int(bar_w * theme_var[theme_var_key]), y, 'x');
    9051040            }
    9061041            else
    9071042            {
    908                 if (setup_var[setup_item_key] != vec4(0))
    909                 {
    910                     caca_put_str(m_cv_setup, setup_size.x - 3, y, (setup_var[setup_item_key].w == setup_var[setup_item_key].y)?"YES":" NO");
     1043                if (setup_conf[setup_item_key] != vec4(0))
     1044                {
     1045                    caca_put_str(m_cv_setup, setup_size.x - 3, y, (theme_var[theme_var_key] == setup_conf[setup_item_key].y)?"YES":" NO");
    9111046                }
    9121047            }
     
    9611096        theme_i--;
    9621097        if(theme_i < 0) theme_i = theme_n - 1;
    963         InitVar();
    964         SetupVar();
    965         UpdateVar();
     1098        InitShaderVar();
    9661099        UpdateSize();
    9671100    }
     
    9691102    {
    9701103        theme_i++;
    971         if(theme_i > theme_n) theme_i = 0;
    972         InitVar();
    973         SetupVar();
    974         UpdateVar();
     1104        if(theme_i > theme_n - 1) theme_i = 0;
     1105        InitShaderVar();
    9751106        UpdateSize();
    9761107    }
     
    11861317        if (g_setup && setup_switch)
    11871318        {
    1188             setup_var[setup_item_key].w -= setup_var[setup_item_key].z;
    1189             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;
    1190             UpdateVar();
     1319            theme_var[theme_var_key] -= setup_conf[setup_item_key].z;
     1320            if (theme_var[theme_var_key] < setup_conf[setup_item_key].x) theme_var[theme_var_key] = setup_conf[setup_item_key].x;
     1321            InitShaderVar();
    11911322            UpdateSize();
    11921323        }
     
    11961327        if (g_setup && setup_switch)
    11971328        {
    1198             setup_var[setup_item_key].w += setup_var[setup_item_key].z;
    1199             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;
    1200             UpdateVar();
     1329            theme_var[theme_var_key] += setup_conf[setup_item_key].z;
     1330            if (theme_var[theme_var_key] > setup_conf[setup_item_key].y) theme_var[theme_var_key] = setup_conf[setup_item_key].y;
     1331            InitShaderVar();
    12011332            UpdateSize();
    12021333        }
     
    12061337        if (g_setup && setup_switch)
    12071338        {
    1208             setup_var[setup_item_key].w = setup_var[setup_item_key].x;
    1209             UpdateVar();
     1339            theme_var[theme_var_key] = setup_conf[setup_item_key].x;
     1340            InitShaderVar();
    12101341            UpdateSize();
    12111342        }
     
    12151346        if (g_setup && setup_switch)
    12161347        {
    1217             setup_var[setup_item_key].w = setup_var[setup_item_key].y;
    1218             UpdateVar();
     1348            theme_var[theme_var_key] = setup_conf[setup_item_key].y;
     1349            InitShaderVar();
    12191350            UpdateSize();
    12201351        }
     
    15111642        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));
    15121643        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));
     1644        shader_postfx->SetUniform(shader_postfx_gradient, postfx_gradient);
     1645        shader_postfx->SetUniform(shader_postfx_gradient_color, postfx_gradient_color);
    15131646        shader_postfx->SetUniform(shader_postfx_vignetting, postfx_vignetting);
    15141647        shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
  • trunk/tools/neercs/video/render.h

    r2045 r2049  
    2828    void Pause();
    2929    void Shader();
    30     void InitVar();
    31     void SetupVar();
     30    void InitShaderVar();
    3231    void UpdateVar();
    3332    void UpdateSize();
  • trunk/tools/neercs/video/text-render.cpp

    r2003 r2049  
    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_amiga.png",
    4444                         ivec2(256, 256), ivec2(1));
    4545
Note: See TracChangeset for help on using the changeset viewer.