From fe7352939750f4a54c91a7cdc8f81f43a391cdba Mon Sep 17 00:00:00 2001 From: rez Date: Tue, 28 Aug 2012 00:01:51 +0000 Subject: [PATCH] added COPPER \:D/ (still buggy btw) --- neercs/neercs.cpp | 9 +++++---- neercs/video/color.lolfx | 15 ++++++++++++++- neercs/video/postfx.lolfx | 2 +- neercs/video/render.cpp | 11 +++++++---- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/neercs/neercs.cpp b/neercs/neercs.cpp index 0e832a8..7391eb4 100644 --- a/neercs/neercs.cpp +++ b/neercs/neercs.cpp @@ -113,13 +113,14 @@ void Neercs::TickGame(float seconds) int logo_x = (w - 46) / 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_set_color_argb(m_caca, 0xfff, bg_color); + //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 ,"__ _________ ______ ______ ______ ______"); - 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); + //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); caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/ \\/ / __ > __ > __ > ___// ___/ \x0a9"); - 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); + //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); caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/ / ____/ ____/ __ < <____\\___ \\"); - 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); + //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); caca_put_str(m_caca, logo_x , logo_y + 3, "/__/\\__/\\_______________/ \\________________\\"); caca_set_color_argb(m_caca, 0xdef, bg_color); caca_put_str(m_caca, logo_x + 5, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US"); diff --git a/neercs/video/color.lolfx b/neercs/video/color.lolfx index a633759..42c574f 100644 --- a/neercs/video/color.lolfx +++ b/neercs/video/color.lolfx @@ -14,6 +14,7 @@ void main() uniform sampler2D texture; uniform vec2 screen_size; +uniform float time; uniform vec3 filter; uniform vec3 color; uniform float flash; @@ -22,6 +23,17 @@ void main(void) { vec2 p=gl_FragCoord.xy/screen_size.xy; vec3 c=texture2D(texture,p).xyz; + vec3 o=c; + + float sinus=0.125+0.125*sin(p.x*float(screen_size.x/32)+time)+0.125*cos(p.y*float(screen_size.x/32)+time); + vec3 copper=vec3(0.5+sinus); + copper.x+=0.5*cos(p.y*float(screen_size.y/64)+time); + copper.z+=0.5*sin(p.y*float(screen_size.y/64)+time); + copper*=0.5+0.25*cos(p.y*float(screen_size.x/6)-time*2.0); + + copper.x=float(int(copper.x*8.0)*32)/256.0; + copper.y=float(int(copper.y*8.0)*32)/256.0; + copper.z=float(int(copper.z*8.0)*32)/256.0; float a=(c.x+c.y+c.z)/3.0; c=mix(c,vec3(a),color.z); // grayscale @@ -30,5 +42,6 @@ void main(void) c=0.5+(c-0.5)*color.y; // contrast c+=flash; // flash - gl_FragColor=vec4(c,1.0); + //gl_FragColor=vec4(c,1.0); + gl_FragColor=vec4((o.x>0.5&&o.y>0.5&&o.z>0.5)?copper:c,1.0); } \ No newline at end of file diff --git a/neercs/video/postfx.lolfx b/neercs/video/postfx.lolfx index 953d89d..1effd75 100644 --- a/neercs/video/postfx.lolfx +++ b/neercs/video/postfx.lolfx @@ -57,7 +57,7 @@ void main(void) vec3 g1=get_color(texture,z1-ghost1.xy); vec3 g2=get_color(texture,z2-ghost2.xy); - vec3 c=source+g1*g1*ghost1.w+g2*g2*ghost2.w; // mix + vec3 c=source+g1*ghost1.w+g2*ghost2.w; // mix float v=aberration/float(screen_size.x)+aberration/float(screen_size.x)*(2.0-mask); vec3 ca1=get_color(texture,vec2(z.x-v,z.y)); diff --git a/neercs/video/render.cpp b/neercs/video/render.cpp index 5ec88fa..86489d9 100644 --- a/neercs/video/render.cpp +++ b/neercs/video/render.cpp @@ -92,16 +92,16 @@ vec2 glow_mix(0.6f,0.4f); // glow mix [source mix,glow mix] vec2 glow_large(2.0f,2.0f); // large glow radius [center,corner] vec2 glow_small(1.0f,1.0f); // small glow radius [center,corner] vec2 blur(0.5f,0.5f); // blur radius [center,corner] -vec3 color_filter(0.9f,1.0f,0.7f); // color filter [red,green,blue] -vec3 color_color(1.1f,1.1f,0.25f); // color modifier [brightness,contrast,grayscale] +vec3 color_filter(0.9f,0.9f,1.0f); // color filter [red,green,blue] +vec3 color_color(1.2f,1.1f,0.25f); // color modifier [brightness,contrast,grayscale] vec2 noise_offset(2.0f,2.0f); // random line [horizontal,vertical] float noise_noise = 0.25f; // noise vec3 noise_retrace(1.0f,1.0f,0.5f); // retrace [strength,length,speed] vec2 postfx_deform(0.7f,0.54f); // deformation [ratio,zoom] float postfx_vignetting = -0.5f; // vignetting strength float postfx_aberration = 4.0f; // chromatic aberration -vec4 postfx_ghost1(0.01f,0.0f,0.1f,-0.4f); // ghost picture 1 [position x,position y,position z,strength] -vec4 postfx_ghost2(0.02f,0.0f,0.1f,0.4f); // ghost picture 2 [position x,position y,position z,strength] +vec4 postfx_ghost1(0.01f,0.0f,0.1f,-0.25f); // ghost picture 1 [position x,position y,position z,strength] +vec4 postfx_ghost2(0.02f,0.0f,0.1f,0.25f); // ghost picture 2 [position x,position y,position z,strength] vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f); // vertical moire [base,variable,repeat x,repeat y] vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f); // horizontal moire [base,variable,repeat x,repeat y] vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f); // vertical scanline [base,variable,repeat x,repeat y] @@ -381,6 +381,7 @@ ShaderUniform shader_glow_glow, shader_glow_mix; ShaderUniform shader_color_texture, shader_color_screen_size, + shader_color_time, shader_color_filter, shader_color_color, shader_color_flash; @@ -475,6 +476,7 @@ int Render::InitDraw(void) shader_color = Shader::Create(lolfx_color); shader_color_texture = shader_color->GetUniformLocation("texture"); shader_color_screen_size = shader_color->GetUniformLocation("screen_size"); + shader_color_time = shader_color->GetUniformLocation("time"); shader_color_filter = shader_color->GetUniformLocation("filter"); shader_color_color = shader_color->GetUniformLocation("color"); shader_color_flash = shader_color->GetUniformLocation("flash"); @@ -950,6 +952,7 @@ void Render::Draw3D() shader_color->Bind(); shader_color->SetUniform(shader_color_texture, fbo_front->GetTexture(), 0); shader_color->SetUniform(shader_color_screen_size, (vec2)screen_size); + shader_color->SetUniform(shader_color_time, fx_angle); shader_color->SetUniform(shader_color_filter, color_filter); shader_color->SetUniform(shader_color_color, color_color); shader_color->SetUniform(shader_color_flash, flash_value);