Преглед на файлове

added smoothstep in postfx (more contrast!) and a magnificient LOLCUBE!

master
rez Sam Hocevar <sam@hocevar.net> преди 12 години
родител
ревизия
6c00476887
променени са 3 файла, в които са добавени 27 реда и са изтрити 9 реда
  1. +17
    -4
      neercs/neercs.cpp
  2. +3
    -2
      neercs/video/postfx.lolfx
  3. +7
    -3
      neercs/video/render.cpp

+ 17
- 4
neercs/neercs.cpp Целия файл

@@ -111,7 +111,7 @@ void Neercs::TickGame(float seconds)
/__/\__/\_______________/ \________________\ */

int logo_x = (w - 46) / 2;
int logo_y = h / 2 - 2;// + h / 4 * lol::cos(m_time * 2);
int logo_y = h / 2 - 2;

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);
caca_put_str(m_caca, logo_x + 3, logo_y ,"__ _________ ______ ______ ______ ______");
@@ -131,10 +131,23 @@ void Neercs::TickGame(float seconds)
caca_set_color_argb(m_caca, hex_color(0.6f + 0.4f * lol::cos(m_time * 2), 0.2f, 0.2f), bg_color);
caca_put_str(m_caca, w - 12, h - 2, "CACA RULEZ");

int lolcube_x = w / 2 - 5 + (w - 10) * lol::cos(m_time / 2);
int lolcube_y = h - 5 - abs ((h - 5) * lol::sin(m_time * 4));

caca_set_color_argb(m_caca, hex_color(0.75f + 0.25f * lol::sin(m_time * 2), 0.75f + 0.25f * lol::cos(m_time * 3), 0.75f + 0.25f * lol::sin(m_time * 5)), bg_color);
caca_put_str(m_caca, lolcube_x + 2, lolcube_y , "_______");
caca_put_str(m_caca, lolcube_x + 1, lolcube_y + 1, "/ /|");
caca_put_str(m_caca, lolcube_x , lolcube_y + 2, "/______/ |");
caca_put_str(m_caca, lolcube_x , lolcube_y + 3, "| | |");
caca_put_str(m_caca, lolcube_x , lolcube_y + 4, "| :D | /");
caca_put_str(m_caca, lolcube_x , lolcube_y + 5, "|______|/");

caca_set_color_argb(m_caca, 0xdef, bg_color);
caca_put_str(m_caca, 0, 0, "mdr@lol:~/ cd code/lolengine/");
caca_put_str(m_caca, 0, 1, "mdr@lol:~/code/lolengine/ cd /var/log/");
caca_put_str(m_caca, 0, 2, "mdr@lol:/var/log/");
caca_put_str(m_caca, 0, 0, "rez@lol:~/ sudo -s");
caca_put_str(m_caca, 0, 1, "[sudo] password for rez:");
caca_put_str(m_caca, 0, 2, "root@lol:~/ echo LOL");
caca_put_str(m_caca, 0, 3, "LOL");
caca_put_str(m_caca, 0, 4, "root@lol:~/");
}




+ 3
- 2
neercs/video/postfx.lolfx Целия файл

@@ -27,6 +27,7 @@ uniform vec4 moire_v;
uniform bool scanline;
uniform vec4 scanline_h;
uniform vec4 scanline_v;
uniform vec2 smooth;
uniform float flash;
uniform float sync;

@@ -80,7 +81,8 @@ void main(void)

vec3 color=source+glass1*glass1*0.25+glass2*glass2*0.25;

color=smoothstep(0.05,1.0,color);
color*=filter; // filter
color=smoothstep(smooth.x,smooth.y,color); // smoothstep
color+=flash; // flash
color+=ca; // chromatic aberration
color-=retrace.x*mod(z.y*retrace.y+time*retrace.z,1.0); // retrace
@@ -103,7 +105,6 @@ void main(void)
{
color*=(scanline_h.x+scanline_v.x)*0.5;
}
color*=filter; // filter
color*=mask; // vignetting
color*=letterbox(z,-0.75,0.95); // letnoiseterbox
gl_FragColor=vec4(color,1.0);

+ 7
- 3
neercs/video/render.cpp Целия файл

@@ -94,14 +94,14 @@ float value, angle, radius, scale, speed;
/* shader variable */
vec2 buffer(0.75f,0.25f); // [new frame mix,old frame mix]
vec2 remanency(0.25f,0.75f); // remanency [source mix,buffer mix]
vec2 blur(0.25f,0.5f); // glow radius [normal,deform]
vec2 glow_mix(0.5f,0.5f); // glow mix [glow mix,source mix]
vec2 blur(0.25f,0.75f); // glow radius [normal,deform]
vec2 glow_mix(0.5f,0.5f); // glow mix [source mix,glow mix]
vec2 glow_large(2.0f,2.0f); // large glow radius [normal,deform]
vec2 glow_small(1.0f,1.0f); // small glow radius [normal,deform]
//vec3 radial(2.0f,0.8f,0); // radial [mix,strength,color mode]
//---------------------------------[IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
float postfx_deform = 0.625f; // deformation ratio
vec3 postfx_filter(0.875f,1.0f,0.75f);// color filter [red,green,blue]
vec3 postfx_filter(0.875f,0.75f,1.0f);// color filter [red,green,blue]
vec3 postfx_retrace(0.025f,2.0f,4.0f);// retrace [color,length,speed]
vec2 postfx_offset(3.0f,3.0f); // random line [horizontal,vertical]
float postfx_noise = 0.125f; // noise
@@ -112,6 +112,7 @@ vec4 postfx_moire_v(0.75f,-0.25f,0.0f,1.0f);
bool postfx_scanline = true; // scanline
vec4 postfx_scanline_h(0.75f,-0.25f,2.0f,0.0f);// vertical scanline [base,variable,repeat]
vec4 postfx_scanline_v(0.75f, 0.25f,0.0f,2.0f);// horizontal scanline [base,variable,repeat]
vec2 postfx_smoothstep(0.025f,0.625f);// smoothstep [lower,upper]

Shader *shader_simple;
Shader *shader_blur_h, *shader_blur_v;
@@ -150,6 +151,7 @@ ShaderUniform shader_postfx_texture,
shader_postfx_scanline,
shader_postfx_scanline_h,
shader_postfx_scanline_v,
shader_postfx_smoothstep,
shader_postfx_flash,
shader_postfx_sync;

@@ -244,6 +246,7 @@ int Render::InitDraw(void)
shader_postfx_scanline = shader_postfx->GetUniformLocation("scanline");
shader_postfx_scanline_h = shader_postfx->GetUniformLocation("scanline_h");
shader_postfx_scanline_v = shader_postfx->GetUniformLocation("scanline_v");
shader_postfx_smoothstep = shader_postfx->GetUniformLocation("smooth");
shader_postfx_flash = shader_postfx->GetUniformLocation("flash");
shader_postfx_sync = shader_postfx->GetUniformLocation("sync");

@@ -553,6 +556,7 @@ void Render::Draw3D()
shader_postfx->SetUniform(shader_postfx_scanline, postfx_scanline);
shader_postfx->SetUniform(shader_postfx_scanline_h, postfx_scanline_h);
shader_postfx->SetUniform(shader_postfx_scanline_v, postfx_scanline_v);
shader_postfx->SetUniform(shader_postfx_smoothstep, postfx_smoothstep);
shader_postfx->SetUniform(shader_postfx_flash, flash_value);
shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(beat_value*cosf((main_angle-beat_angle)*8.0f)));
fs_quad();


Зареждане…
Отказ
Запис