Changeset 2021


Ignore:
Timestamp:
Oct 17, 2012, 2:24:43 AM (5 years ago)
Author:
rez
Message:

neercs: scanline auto-resize

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

Legend:

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

    r2017 r2021  
    1515uniform sampler2D texture;
    1616uniform vec2 screen_size;
     17uniform vec2 ratio_2d;
    1718uniform float time;
    1819uniform vec2 deform;
     
    6162    vec3 c=source+g1*ghost1.w+g2*ghost2.w;                   // mix
    6263
    63     float v=aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask);
     64    float v=aberration/float(screen_size.x/ratio_2d.x);//+aberration/float(screen_size.x)*(2.0-mask);
    6465    vec3 ca1=get_color(texture,vec2(z.x-v,z.y));
    6566    vec3 ca2=get_color(texture,vec2(z.x+v,z.y));
     
    8182    if(k>=r_p+r_h) r=mix(c4,c5,k*((k-(r_p+r_h))/(r_p-r_h)));
    8283
    83     c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w)); // moire h
    84     c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w)); // moire v
    85     c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h
    86     c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v
     84    c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z)/ratio_2d.y)*sin(0.5+z.x*float(screen_size.x*moire_h.w)/ratio_2d.x); // moire h
     85    c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z)/ratio_2d.x)*sin(0.5+z.y*float(screen_size.y*moire_v.w)/ratio_2d.y); // moire v
     86    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
     87    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
    8788    c+=r*0.05;                                               // reflection
    8889    c*=mix(1.0,mask,vignetting);                             // vignetting
  • trunk/tools/neercs/video/render.cpp

    r2017 r2021  
    495495              shader_postfx_texture_2d,
    496496              shader_postfx_screen_size,
     497              shader_postfx_ratio_2d,
    497498              shader_postfx_time,
    498499              shader_postfx_deform,
     
    595596    shader_postfx_texture_2d = shader_postfx->GetUniformLocation("texture_2d");
    596597    shader_postfx_screen_size = shader_postfx->GetUniformLocation("screen_size");
     598    shader_postfx_ratio_2d = shader_postfx->GetUniformLocation("ratio_2d");
    597599    shader_postfx_time = shader_postfx->GetUniformLocation("time");
    598600    shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
     
    13051307        shader_postfx->SetUniform(shader_postfx_texture, fbo_screen->GetTexture(), 0);
    13061308        shader_postfx->SetUniform(shader_postfx_screen_size, (vec2)screen_size);
     1309        shader_postfx->SetUniform(shader_postfx_ratio_2d, (vec2)ratio_2d / 2);
    13071310        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
    13081311        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
Note: See TracChangeset for help on using the changeset viewer.