Changeset 1836
- Timestamp:
- Aug 30, 2012, 1:41:59 AM (9 years ago)
- Location:
- trunk/tools/neercs
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/neercs/Makefile.am
r1820 r1836 12 12 video/text-render.cpp video/text-render.h \ 13 13 video/simple.lolfx \ 14 video/blurh.lolfx video/blurv.lolfx video/glow.lolfx video/color.lolfx \ 15 video/remanency.lolfx video/noise.lolfx video/postfx.lolfx\ 14 video/blurh.lolfx video/blurv.lolfx video/glow.lolfx \ 15 video/remanency.lolfx video/copper.lolfx video/color.lolfx \ 16 video/noise.lolfx video/postfx.lolfx \ 16 17 video/text.lolfx 17 18 neercs_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ @CACA_CFLAGS@ -Iold -
trunk/tools/neercs/neercs.cpp
r1829 r1836 87 87 caca_clear_canvas(m_caca); 88 88 89 caca_set_color_argb(m_caca, 0x 545, bg_color);89 caca_set_color_argb(m_caca, 0xfff, bg_color); 90 90 for(int i = 0; i < h; i++) 91 91 { … … 114 114 int logo_y = h / 2 - 2; 115 115 116 caca_set_color_argb(m_caca, 0xfff, bg_color); 117 //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); 116 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); 118 117 caca_put_str(m_caca, logo_x + 3, logo_y ,"__ _________ ______ ______ ______ ______"); 119 //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);118 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); 120 119 caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/ \\/ / __ > __ > __ > ___// ___/ \x0a9"); 121 //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);120 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); 122 121 caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/ / ____/ ____/ __ < <____\\___ \\"); 123 //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);122 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); 124 123 caca_put_str(m_caca, logo_x , logo_y + 3, "/__/\\__/\\_______________/ \\________________\\"); 125 124 caca_set_color_argb(m_caca, 0xdef, bg_color); -
trunk/tools/neercs/neercs.vcxproj
r1820 r1836 84 84 <LolFxCompile Include="video\blurv.lolfx" /> 85 85 <LolFxCompile Include="video\glow.lolfx" /> 86 <LolFxCompile Include="video\copper.lolfx" /> 86 87 <LolFxCompile Include="video\color.lolfx" /> 87 88 <LolFxCompile Include="video\remanency.lolfx" /> -
trunk/tools/neercs/neercs.vcxproj.filters
r1820 r1836 130 130 <Filter>video</Filter> 131 131 </LolFxCompile> 132 <LolFxCompile Include="video\copper.lolfx"> 133 <Filter>video</Filter> 134 </LolFxCompile> 132 135 <LolFxCompile Include="video\color.lolfx"> 133 136 <Filter>video</Filter> -
trunk/tools/neercs/video/color.lolfx
r1829 r1836 15 15 uniform sampler2D texture; 16 16 uniform vec2 screen_size; 17 uniform float time;18 17 uniform vec3 filter; 19 18 uniform vec3 color; … … 24 23 vec2 p=gl_FragCoord.xy/screen_size.xy; 25 24 vec3 c=texture2D(texture,p).xyz; 26 vec3 o=c;27 28 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);29 vec3 copper=vec3(0.5+sinus);30 copper.x+=0.5*cos(p.y*float(screen_size.y/64)+time);31 copper.z+=0.5*sin(p.y*float(screen_size.y/64)+time);32 copper*=0.5+0.25*cos(p.y*float(screen_size.x/6)-time*2.0);33 34 copper.x=float(int(copper.x*8.0)*32)/256.0;35 copper.y=float(int(copper.y*8.0)*32)/256.0;36 copper.z=float(int(copper.z*8.0)*32)/256.0;37 25 38 26 float a=(c.x+c.y+c.z)/3.0; … … 43 31 c+=flash; // flash 44 32 45 //gl_FragColor=vec4(c,1.0); 46 gl_FragColor=vec4((o.x>0.5&&o.y>0.5&&o.z>0.5)?copper:c,1.0); 33 gl_FragColor=vec4(c,1.0); 47 34 } -
trunk/tools/neercs/video/render.cpp
r1829 r1836 33 33 34 34 extern char const *lolfx_simple; 35 extern char const *lolfx_remanency;36 35 extern char const *lolfx_blurh; 37 36 extern char const *lolfx_blurv; 38 37 extern char const *lolfx_glow; 38 extern char const *lolfx_remanency; 39 extern char const *lolfx_copper; 39 40 extern char const *lolfx_color; 40 41 extern char const *lolfx_noise; … … 93 94 vec2 glow_small(1.0f,1.0f); // small glow radius [center,corner] 94 95 vec2 blur(0.5f,0.5f); // blur radius [center,corner] 96 vec4 copper(0.125,0.125,32,64); // copper [base,variable,repeat x,repeat y] 95 97 vec3 color_filter(0.9f,0.9f,1.0f); // color filter [red,green,blue] 96 98 vec3 color_color(1.2f,1.1f,0.25f); // color modifier [brightness,contrast,grayscale] … … 365 367 366 368 Shader *shader_simple; 367 Shader *shader_ remanency;368 Shader *shader_ blur_h, *shader_blur_v, *shader_glow, *shader_color;369 Shader *shader_blur_h, *shader_blur_v, *shader_glow; 370 Shader *shader_remanency, *shader_copper, *shader_color; 369 371 Shader *shader_noise, *shader_postfx; 370 372 // shader variables 371 373 ShaderUniform shader_simple_texture; 372 ShaderUniform shader_remanency_source,373 shader_remanency_buffer,374 shader_remanency_mix;375 374 ShaderUniform shader_blur_h_texture, 376 375 shader_blur_h_radius, … … 380 379 shader_glow_source, 381 380 shader_glow_mix; 381 ShaderUniform shader_remanency_source, 382 shader_remanency_buffer, 383 shader_remanency_mix; 384 ShaderUniform shader_copper_texture, 385 shader_copper_screen_size, 386 shader_copper_time, 387 shader_copper_copper; 382 388 ShaderUniform shader_color_texture, 383 389 shader_color_screen_size, 384 shader_color_time,385 390 shader_color_filter, 386 391 shader_color_color, … … 409 414 410 415 FrameBuffer *fbo_back, *fbo_front, *fbo_buffer; 411 FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_ ping, *fbo_pong;416 FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_tmp; 412 417 413 418 TextRender *text_render; … … 450 455 fbo_blur_h = new FrameBuffer(screen_size); 451 456 fbo_blur_v = new FrameBuffer(screen_size); 452 fbo_ping = new FrameBuffer(screen_size); 453 fbo_pong = new FrameBuffer(screen_size); 457 fbo_tmp = new FrameBuffer(screen_size); 454 458 // shader simple 455 459 shader_simple = Shader::Create(lolfx_simple); 456 460 shader_simple_texture = shader_simple->GetUniformLocation("texture"); 457 // shader remanency458 shader_remanency = Shader::Create(lolfx_remanency);459 shader_remanency_source = shader_remanency->GetUniformLocation("source");460 shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer");461 shader_remanency_mix = shader_remanency->GetUniformLocation("mix");462 461 // shader glow 463 462 shader_glow = Shader::Create(lolfx_glow); … … 473 472 shader_blur_v_texture = shader_blur_v->GetUniformLocation("texture"); 474 473 shader_blur_v_radius = shader_blur_v->GetUniformLocation("radius"); 474 // shader remanency 475 shader_remanency = Shader::Create(lolfx_remanency); 476 shader_remanency_source = shader_remanency->GetUniformLocation("source"); 477 shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer"); 478 shader_remanency_mix = shader_remanency->GetUniformLocation("mix"); 479 // shader copper 480 shader_copper = Shader::Create(lolfx_copper); 481 shader_copper_texture = shader_copper->GetUniformLocation("texture"); 482 shader_copper_screen_size = shader_copper->GetUniformLocation("screen_size"); 483 shader_copper_time = shader_copper->GetUniformLocation("time"); 484 shader_copper_copper = shader_copper->GetUniformLocation("copper"); 475 485 // shader color 476 486 shader_color = Shader::Create(lolfx_color); 477 487 shader_color_texture = shader_color->GetUniformLocation("texture"); 478 488 shader_color_screen_size = shader_color->GetUniformLocation("screen_size"); 479 shader_color_time = shader_color->GetUniformLocation("time");480 489 shader_color_filter = shader_color->GetUniformLocation("filter"); 481 490 shader_color_color = shader_color->GetUniformLocation("color"); … … 538 547 m_setup(true), 539 548 m_shader(true), 540 m_shader_remanency(true),541 549 m_shader_glow(true), 542 550 m_shader_blur(true), 551 m_shader_remanency(true), 552 m_shader_copper(true), 543 553 m_shader_color(true), 544 554 m_shader_noise(true), … … 863 873 glTexCoordPointer(2, GL_FLOAT, 0, fs_quad_tex); 864 874 875 if (m_shader_copper) 876 { 877 // shader copper 878 fbo_tmp->Bind(); 879 shader_copper->Bind(); 880 shader_copper->SetUniform(shader_copper_texture, fbo_back->GetTexture(), 0); 881 shader_copper->SetUniform(shader_copper_screen_size, (vec2)screen_size); 882 shader_copper->SetUniform(shader_copper_time, fx_angle); 883 shader_copper->SetUniform(shader_copper_copper, copper); 884 fs_quad(); 885 shader_color->Unbind(); 886 fbo_tmp->Unbind(); 887 // shader simple 888 fbo_back->Bind(); 889 draw_shader_simple(fbo_tmp, 0); 890 fbo_back->Unbind(); 891 } 892 865 893 if (m_shader_remanency) 866 894 { 867 895 // shader remanency 868 fbo_ ping->Bind();896 fbo_tmp->Bind(); 869 897 shader_remanency->Bind(); 870 898 shader_remanency->SetUniform(shader_remanency_source, fbo_back->GetTexture(), 0); … … 873 901 fs_quad(); 874 902 shader_remanency->Unbind(); 875 fbo_ ping->Unbind();903 fbo_tmp->Unbind(); 876 904 // shader simple 877 905 fbo_back->Bind(); 878 draw_shader_simple(fbo_ ping, 0);906 draw_shader_simple(fbo_tmp, 0); 879 907 fbo_back->Unbind(); 880 908 // save previous fbo 881 fbo_ ping->Bind();909 fbo_tmp->Bind(); 882 910 shader_remanency->Bind(); 883 911 shader_remanency->SetUniform(shader_remanency_source, fbo_front->GetTexture(), 0); … … 886 914 fs_quad(); 887 915 shader_remanency->Unbind(); 888 fbo_ ping->Unbind();916 fbo_tmp->Unbind(); 889 917 // shader simple 890 918 fbo_buffer->Bind(); 891 draw_shader_simple(fbo_ ping, 0);919 draw_shader_simple(fbo_tmp, 0); 892 920 fbo_buffer->Unbind(); 893 921 } … … 949 977 { 950 978 // shader color 951 fbo_ ping->Bind();979 fbo_tmp->Bind(); 952 980 shader_color->Bind(); 953 981 shader_color->SetUniform(shader_color_texture, fbo_front->GetTexture(), 0); 954 982 shader_color->SetUniform(shader_color_screen_size, (vec2)screen_size); 955 shader_color->SetUniform(shader_color_time, fx_angle);956 983 shader_color->SetUniform(shader_color_filter, color_filter); 957 984 shader_color->SetUniform(shader_color_color, color_color); … … 959 986 fs_quad(); 960 987 shader_color->Unbind(); 961 fbo_ ping->Unbind();988 fbo_tmp->Unbind(); 962 989 // shader simple 963 990 fbo_front->Bind(); 964 draw_shader_simple(fbo_ ping, 0);991 draw_shader_simple(fbo_tmp, 0); 965 992 fbo_front->Unbind(); 966 993 } … … 969 996 { 970 997 // shader noise 971 fbo_ ping->Bind();998 fbo_tmp->Bind(); 972 999 shader_noise->Bind(); 973 1000 shader_noise->SetUniform(shader_noise_texture, fbo_front->GetTexture(), 0); … … 979 1006 fs_quad(); 980 1007 shader_noise->Unbind(); 981 fbo_ ping->Unbind();1008 fbo_tmp->Unbind(); 982 1009 // shader simple 983 1010 fbo_front->Bind(); 984 draw_shader_simple(fbo_ ping, 0);1011 draw_shader_simple(fbo_tmp, 0); 985 1012 fbo_front->Unbind(); 986 1013 } … … 989 1016 { 990 1017 // shader blur horizontal 991 fbo_ ping->Bind();1018 fbo_tmp->Bind(); 992 1019 shader_blur_h->Bind(); 993 1020 shader_blur_h->SetUniform(shader_blur_h_texture, fbo_front->GetTexture(), 0); … … 995 1022 fs_quad(); 996 1023 shader_blur_h->Unbind(); 997 fbo_ ping->Unbind();1024 fbo_tmp->Unbind(); 998 1025 // shader blur vertical 999 1026 fbo_front->Bind(); 1000 1027 shader_blur_v->Bind(); 1001 shader_blur_v->SetUniform(shader_blur_v_texture, fbo_ ping->GetTexture(), 0);1028 shader_blur_v->SetUniform(shader_blur_v_texture, fbo_tmp->GetTexture(), 0); 1002 1029 shader_blur_v->SetUniform(shader_blur_v_radius, blur / screen_size.y); 1003 1030 fs_quad(); -
trunk/tools/neercs/video/render.h
r1820 r1836 34 34 bool m_setup; 35 35 bool m_shader; 36 bool m_shader_remanency;37 36 bool m_shader_glow; 38 37 bool m_shader_blur; 38 bool m_shader_remanency; 39 bool m_shader_copper; 39 40 bool m_shader_color; 40 41 bool m_shader_noise;
Note: See TracChangeset
for help on using the changeset viewer.