Changeset 2007
- Timestamp:
- Oct 11, 2012, 3:01:35 AM (10 years ago)
- Location:
- trunk/tools/neercs
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/neercs/Makefile.am
r1981 r2007 18 18 video/simple.lolfx \ 19 19 video/blurh.lolfx video/blurv.lolfx video/glow.lolfx \ 20 video/remanence.lolfx video/copper.lolfx video/color.lolfx \21 video/ noise.lolfx video/postfx.lolfx video/mirror.lolfx \20 video/remanence.lolfx video/copper.lolfx video/color.lolfx video/noise.lolfx \ 21 video/postfx.lolfx video/mirror.lolfx video/radial.lolfx \ 22 22 video/text.lolfx 23 23 neercs_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ @CACA_CFLAGS@ -Iold -
trunk/tools/neercs/neercs.vcxproj
r1971 r2007 93 93 <LolFxCompile Include="video\postfx.lolfx" /> 94 94 <LolFxCompile Include="video\mirror.lolfx" /> 95 <LolFxCompile Include="video\radial.lolfx" /> 95 96 </ItemGroup> 96 97 <PropertyGroup Label="Globals"> -
trunk/tools/neercs/neercs.vcxproj.filters
r1971 r2007 160 160 <Filter>video</Filter> 161 161 </LolFxCompile> 162 <LolFxCompile Include="video\radial.lolfx"> 163 <Filter>video</Filter> 164 </LolFxCompile> 162 165 </ItemGroup> 163 166 </Project> -
trunk/tools/neercs/video/color.lolfx
r1962 r2007 24 24 vec3 c = texture2D(texture,p).xyz; 25 25 26 float a = (c.x +c.y+c.z)/3.0;27 c = mix(c, vec3(a),color.w);// grayscale26 float a = (c.x + c.y + c.z) / 3.0; 27 c = mix(c, vec3(a), color.w); // grayscale 28 28 c *= filter; // filter 29 c += color.z *0.1;// level29 c += color.z * 0.1; // level 30 30 c *= color.x; // brightness 31 c = 0.5 +(c-0.5)*color.y;// contrast31 c = 0.5 + (c - 0.5) * color.y; // contrast 32 32 c += flash; // flash 33 33 34 gl_FragColor = vec4(c, 1.0);34 gl_FragColor = vec4(c, 1.0); 35 35 } -
trunk/tools/neercs/video/mirror.lolfx
r1993 r2007 20 20 { 21 21 vec2 p = gl_TexCoord[0].xy; 22 vec3 s ource= texture2D(texture, p).xyz;22 vec3 s = texture2D(texture, p).xyz; 23 23 24 vec3 c olor= vec3(0.0);25 if(p.x < mirror.x) c olor= (texture2D(texture, vec2(mirror.x + (mirror.x - p.x) * mirror.w, p.y)).xyz) * (mirror.z / mirror.x * p.x);26 if(p.x > 1.0 - mirror.x) c olor= (texture2D(texture, vec2(- mirror.x - (mirror.x + p.x) * mirror.w, p.y)).xyz) * (mirror.z / mirror.x * (1.0 - p.x));27 if(p.y < mirror.y) c olor= (texture2D(texture, vec2(p.x, mirror.y + (mirror.y - p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * p.y);28 if(p.y > 1.0 - mirror.y) c olor= (texture2D(texture, vec2(p.x, - mirror.y - (mirror.y + p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * (1.0 - p.y));24 vec3 c = vec3(0.0); 25 if(p.x < mirror.x) c = (texture2D(texture, vec2(mirror.x + (mirror.x - p.x) * mirror.w, p.y)).xyz) * (mirror.z / mirror.x * p.x); 26 if(p.x > 1.0 - mirror.x) c = (texture2D(texture, vec2(- mirror.x - (mirror.x + p.x) * mirror.w, p.y)).xyz) * (mirror.z / mirror.x * (1.0 - p.x)); 27 if(p.y < mirror.y) c = (texture2D(texture, vec2(p.x, mirror.y + (mirror.y - p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * p.y); 28 if(p.y > 1.0 - mirror.y) c = (texture2D(texture, vec2(p.x, - mirror.y - (mirror.y + p.y) * mirror.w)).xyz) * (mirror.z / mirror.y * (1.0 - p.y)); 29 29 30 gl_FragColor = vec4(s ource + color + color * color, 1.0);30 gl_FragColor = vec4(s + c, 1.0); 31 31 } -
trunk/tools/neercs/video/postfx.lolfx
r1962 r2007 5 5 void main() 6 6 { 7 gl_Position =gl_Vertex;8 gl_TexCoord[0] =gl_MultiTexCoord0;7 gl_Position=gl_Vertex; 8 gl_TexCoord[0]=gl_MultiTexCoord0; 9 9 } 10 10 … … 31 31 vec2 screen(in vec2 p,in float radius) 32 32 { 33 float d =deform.x+sync*0.0625+beat*0.0375;33 float d=deform.x+sync*0.0625+beat*0.0375; 34 34 return p*(1.5-(radius*cos(p.x*d)+radius*cos(p.y*d)))-0.5; 35 35 } … … 47 47 void main(void) 48 48 { 49 vec2 q =gl_FragCoord.xy/screen_size.xy;50 vec2 p =-1.0+2.0*gl_FragCoord.xy/screen_size.xy;51 p.y +=0.025*sync;52 vec2 z =screen(p,deform.y);53 vec2 z1 =screen(p,deform.y+ghost1.z*0.01);54 vec2 z2 =screen(p,deform.y+ghost2.z*0.01);55 float mask =q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);49 vec2 q=gl_FragCoord.xy/screen_size.xy; 50 vec2 p=-1.0+2.0*gl_FragCoord.xy/screen_size.xy; 51 p.y+=0.025*sync; 52 vec2 z=screen(p,deform.y); 53 vec2 z1=screen(p,deform.y+ghost1.z*0.01); 54 vec2 z2=screen(p,deform.y+ghost2.z*0.01); 55 float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0); 56 56 57 vec3 source =get_color(texture,z);58 vec3 g1 =get_color(texture,z1-ghost1.xy*0.01);59 vec3 g2 =get_color(texture,z2-ghost2.xy*0.01);57 vec3 source=get_color(texture,z); 58 vec3 g1=get_color(texture,z1-ghost1.xy*0.01); 59 vec3 g2=get_color(texture,z2-ghost2.xy*0.01); 60 60 61 vec3 c =source+g1*ghost1.w+g2*ghost2.w; // mix61 vec3 c=source+g1*ghost1.w+g2*ghost2.w; // mix 62 62 63 float v =aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask);64 vec3 ca1 =get_color(texture,vec2(z.x-v,z.y));65 vec3 ca2 =get_color(texture,vec2(z.x+v,z.y));66 c +=vec3(ca1.x,c.y,ca2.z); // chromatic aberration63 float v=aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask); 64 vec3 ca1=get_color(texture,vec2(z.x-v,z.y)); 65 vec3 ca2=get_color(texture,vec2(z.x+v,z.y)); 66 c+=vec3(ca1.x,c.y,ca2.z); // chromatic aberration 67 67 68 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 69 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 70 c *= scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h 71 c *= scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v 72 c *= mix(1.0,mask,vignetting); // vignetting 73 c *= letterbox(z,corner.x+2.0,corner.y,corner.z); // corner 74 gl_FragColor = vec4(c,1.0); 68 vec3 c1=vec3(0.3,0.2,0.2); 69 vec3 c2=vec3(1.0,1.0,1.0); 70 vec3 c3=vec3(0.0,0.4,0.7); 71 72 c+=((p.y<0.0)?mix(c1,c2,1.0+p.y):mix(c2,c3,p.y))*0.25; // reflection 73 74 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 75 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 76 c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h 77 c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v 78 c*=mix(1.0,mask,vignetting); // vignetting 79 c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner 80 gl_FragColor=vec4(c,1.0); 75 81 } -
trunk/tools/neercs/video/render.cpp
r2005 r2007 43 43 extern char const *lolfx_postfx; 44 44 extern char const *lolfx_mirror; 45 extern char const *lolfx_radial; 45 46 46 47 #define PID M_PI/180.0f // pi ratio … … 103 104 vec3 copper_mask_color(4.0f,4.0f,4.0f); // color [red,green,blue] 104 105 vec3 color_filter(0.9f,0.95f,0.85f); // color filter [red,green,blue] 105 vec4 color_color(1. 4f,1.2f,0.1f,0.35f);// color modifier [brightness,contrast,level,grayscale]106 vec4 color_color(1.0f,1.25f,0.0f,0.35f); // color modifier [brightness,contrast,level,grayscale] 106 107 vec2 noise_offset(1.0f,1.0f); // random line [horizontal,vertical] 107 108 float noise_noise = 0.15f; // noise 108 109 vec3 noise_retrace(1.0f,1.0f,0.5f); // retrace [strength,length,speed] 109 vec2 postfx_deform(0.8f,0. 52f); // deformation [ratio,zoom]110 vec2 postfx_deform(0.8f,0.48f); // deformation [ratio,zoom] 110 111 float postfx_vignetting = 0.5f; // vignetting strength 111 112 float postfx_aberration = 4.0f; // chromatic aberration … … 117 118 vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat,shift] 118 119 vec3 postfx_corner(0.0f,0.8f,0.96f); // corner [width,radius,blur] 119 vec4 mirror(0.6f,0.6f,0.4f,4.0f); // mirror [width,height,strength,ratio] 120 vec4 mirror(0.95f,0.9f,0.4f,3.0f); // mirror [width,height,strength,ratio] 121 vec4 radial(4.0f,0.94f,32,0.25f); // radial [distance,fade ratio,iteration,strength] 120 122 /* text variable */ 121 123 ivec2 ratio_2d(2,3); // 2d ratio … … 124 126 ivec2 canvas_char(0,0); // canvas char number 125 127 ivec2 canvas_size(0,0); // caca size 126 ivec2 border(2 * ratio_2d.x * font_size.x,1 * ratio_2d. x* font_size.y); // border width128 ivec2 border(2 * ratio_2d.x * font_size.x,1 * ratio_2d.y * font_size.y); // border width 127 129 /* setup variable */ 128 130 bool setup_switch = false; // switch [option/item] … … 131 133 int setup_cursor = 0; // cursor position 132 134 int setup_option_i = 0; // selected option 133 int setup_option_n = 1 2; // option number135 int setup_option_n = 13; // option number 134 136 int setup_option_p = 0; // option position 135 137 int setup_item_i = 0; // selected item … … 248 250 "", 249 251 "", 252 "", 253 "radial", 254 "enable", 255 "distance", 256 "fade ratio", 257 "iteration", 258 "strength", 259 "", 260 "", 250 261 "" 251 262 }; … … 356 367 vec4(0.0f, 2.0f, 0.05f, mirror.y), 357 368 vec4(0.0f, 1.0f, 0.05f, mirror.z), 358 vec4(1.0f, 4.0f, 0.25f, mirror.w), 369 vec4(1.0f, 8.0f, 1.00f, mirror.w), 370 vec4(0), 371 vec4(0), 372 vec4(0), 373 vec4(0), /* radial blur */ 374 vec4(0, 1, 1, 1), 375 vec4(2.0f, 8.0f, 0.25f, radial.x), 376 vec4(0.5f, 1.0f, 0.01f, radial.y), 377 vec4(2.0f,64.0f, 2.00f, radial.z), 378 vec4(0.0f, 1.0f, 0.05f, radial.w), 359 379 vec4(0), 360 380 vec4(0), … … 410 430 m_shader_mirror = (setup_var[k].w == 1) ? true : false; k++; 411 431 mirror = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4; 432 k += 4; /* radial blur */ 433 m_shader_radial = (setup_var[k].w == 1) ? true : false; k++; 434 radial = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4; 412 435 UpdateSize(); 413 436 } … … 440 463 Shader *shader_blur_h, *shader_blur_v, *shader_glow; 441 464 Shader *shader_remanence, *shader_copper, *shader_color; 442 Shader *shader_noise, *shader_postfx, *shader_mirror ;465 Shader *shader_noise, *shader_postfx, *shader_mirror, *shader_radial; 443 466 // shader variables 444 467 ShaderUniform shader_simple_texture; … … 488 511 shader_mirror_screen_size, 489 512 shader_mirror_mirror; 513 ShaderUniform shader_radial_texture, 514 shader_radial_screen_size, 515 shader_radial_radial; 490 516 491 517 FrameBuffer *fbo_back, *fbo_front, *fbo_screen; … … 587 613 shader_mirror_screen_size = shader_mirror->GetUniformLocation("screen_size"); 588 614 shader_mirror_mirror = shader_mirror->GetUniformLocation("mirror"); 615 // shader radial blur 616 shader_radial = Shader::Create(lolfx_radial); 617 shader_radial_texture = shader_radial->GetUniformLocation("texture"); 618 shader_radial_screen_size = shader_radial->GetUniformLocation("screen_size"); 619 shader_radial_radial = shader_radial->GetUniformLocation("radial"); 589 620 // initialize setup 590 621 setup_n = calc_item_length(); … … 605 636 m_ready(false), 606 637 m_pause(false), 607 m_polygon(true),608 638 m_shader(true), 609 639 m_shader_glow(true), … … 614 644 m_shader_noise(true), 615 645 m_shader_postfx(true), 616 m_shader_mirror(true) 646 m_shader_mirror(true), 647 m_shader_radial(true) 617 648 { 618 649 m_txt_screen = new TextRender(m_cv_screen, font_size); … … 623 654 { 624 655 Entity::TickGame(seconds); 625 626 /* draw LOLCUBE */627 /*628 caca_set_color_argb(m_cv_screen, 0xfff, 0x000);629 caca_put_str(m_cv_screen, canvas_char.x - 8, canvas_char.y - 6, "_______");630 caca_put_str(m_cv_screen, canvas_char.x - 9, canvas_char.y - 5, "/ /|");631 caca_put_str(m_cv_screen, canvas_char.x - 10, canvas_char.y - 4, "/______/ |");632 caca_put_str(m_cv_screen, canvas_char.x - 10, canvas_char.y - 3, "| | |");633 caca_put_str(m_cv_screen, canvas_char.x - 10, canvas_char.y - 2, "| :D | /");634 caca_put_str(m_cv_screen, canvas_char.x - 10, canvas_char.y - 1, "|______|/");635 */636 637 656 /* draw setup */ 638 657 if (g_setup) … … 647 666 caca_put_str(m_cv_setup, setup_size.x / 2 - 3, 0, "SETUP"); 648 667 /* informations */ 668 /* 649 669 int w = caca_get_canvas_width(m_cv_screen); 650 670 int h = caca_get_canvas_height(m_cv_screen); 651 671 caca_set_color_argb(m_cv_setup, setup_color.y, setup_color.x); 652 672 caca_printf(m_cv_setup, 1, 0, "%i*%i", w, h); 673 */ 653 674 /* display option */ 654 675 for (int i = 0; i < setup_h; i++) … … 756 777 m_shader_postfx = !m_shader_postfx; 757 778 m_shader_mirror = !m_shader_mirror; 758 //m_polygon = !m_polygon; 759 //polygon_fillmode = (m_polygon)?GL_FILL:GL_LINE; 760 //glPolygonMode(GL_FRONT, polygon_fillmode); 779 m_shader_radial = !m_shader_radial; 761 780 } 762 781 if (Input::WasPressed(Key::Tab)) … … 1084 1103 1085 1104 /* Clear the back buffer */ 1105 glEnable(GL_TEXTURE_2D); 1086 1106 glEnable(GL_BLEND); 1087 1107 glBlendFunc(GL_SRC_COLOR, GL_DST_ALPHA); … … 1094 1114 if (g_setup) 1095 1115 m_txt_setup->Blit((screen_size - setup_canvas_size) / 2, setup_canvas_size); 1096 1097 //if (m_polygon) glEnable(GL_LINE_SMOOTH); else glDisable(GL_LINE_SMOOTH);1098 glLineWidth((m_polygon)?2.0f:1.0f);1099 fx_angle=main_angle-part_angle;1100 if (m_polygon)1101 glEnable(GL_TEXTURE_2D);1102 1116 1103 1117 glMatrixMode(GL_PROJECTION); … … 1105 1119 glLoadMatrixf(&m[0][0]); 1106 1120 glMatrixMode(GL_MODELVIEW); 1121 1122 fx_angle=main_angle-part_angle; 1107 1123 } 1108 1124 … … 1331 1347 } 1332 1348 1349 if (m_shader_radial) 1350 { 1351 // shader radial blur 1352 fbo_tmp->Bind(); 1353 shader_radial->Bind(); 1354 shader_radial->SetUniform(shader_radial_texture, fbo_front->GetTexture(), 0); 1355 shader_radial->SetUniform(shader_radial_screen_size, (vec2)screen_size); 1356 shader_radial->SetUniform(shader_radial_radial, vec4(radial.x, radial.y, radial.z, radial.w * 0.1f)); 1357 TraceQuad(); 1358 shader_radial->Unbind(); 1359 fbo_tmp->Unbind(); 1360 // shader simple 1361 fbo_front->Bind(); 1362 ShaderSimple(fbo_tmp, 0); 1363 fbo_front->Unbind(); 1364 } 1365 1333 1366 // shader simple 1334 1367 ShaderSimple(fbo_front, 0); … … 1343 1376 Ticker::Unref(m_fps_debug); 1344 1377 } 1345 -
trunk/tools/neercs/video/render.h
r1999 r2007 38 38 bool m_ready; 39 39 bool m_pause; 40 bool m_polygon;41 40 bool m_shader; 42 41 bool m_shader_glow; … … 48 47 bool m_shader_postfx; 49 48 bool m_shader_mirror; 49 bool m_shader_radial; 50 50 }; 51 51 52 52 #endif // __VIDEO_RENDER_H__ 53
Note: See TracChangeset
for help on using the changeset viewer.