Просмотр исходного кода

updated logo + optimized postfx

master
rez Sam Hocevar <sam@hocevar.net> 12 лет назад
Родитель
Сommit
199b6b818f
2 измененных файлов: 25 добавлений и 14 удалений
  1. +13
    -6
      neercs/neercs.cpp
  2. +12
    -8
      neercs/video/postfx.lolfx

+ 13
- 6
neercs/neercs.cpp Просмотреть файл

@@ -112,19 +112,26 @@ void Neercs::TickGame(float seconds)
caca_draw_thin_line(m_caca, x2, y2, x3, y3);
caca_draw_thin_line(m_caca, x3, y3, x1, y1);

int logo_x = -1;
int logo_x = 1;
int logo_y = h / 2 - 3;

/*
___ __ ______ ______ ______ ______ ______
\ \| / ____Y ____Y __ \/ ___// ___/
/ ` > ____> ____> ,_ < <____\___ \
/__/\___\______\______\__| \__\_____________\
*/

caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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, logo_y ," ___ __ _______ _______ _______ ._____ _______. ");
caca_put_str(m_caca, logo_x, logo_y ," ___ __ ______ ______ ______ ______ ______");
caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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, logo_y + 1, "| \\| Y ____Y ____Y ___ \\/ .___Y ___/ ");
caca_put_str(m_caca, logo_x, logo_y + 1, " \\ \\| / ____Y ____Y __ \\/ ___// ___/");
caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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, logo_y + 2, "| . ° > ____> ____> .__ / <_____\\____ \\ ");
caca_put_str(m_caca, logo_x, logo_y + 2, " / ` > ____> ____> ,_ < <____\\___ \\");
caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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_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 + 7, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US!");
caca_put_str(m_caca, logo_x + 5, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US");

caca_set_color_ansi(m_caca, 0x666, bg_color);
caca_printf(m_caca, 1, h - 2, "W=%i H=%i", w, h);


+ 12
- 8
neercs/video/postfx.lolfx Просмотреть файл

@@ -32,7 +32,8 @@ vec2 zoom(in vec2 p,in float radius)

vec3 get_color(in sampler2D tex,in vec2 p)
{
return (p.x<-1.0||p.x>0.0||p.y<-1.0||p.y>0.0)?vec3(0.0,0.0,0.0):texture2D(tex,p).xyz;
//return (p.x<-1.0||p.x>0.0||p.y<-1.0||p.y>0.0)?vec3(0.0,0.0,0.0):texture2D(tex,p).xyz;
return texture2D(tex,clamp(p,-1.0,0.0)).xyz;
}

float rand(in vec2 p)
@@ -40,17 +41,19 @@ float rand(in vec2 p)
return fract(sin(dot(p.xy,vec2(12.9898,78.233)))*43758.5453);
}

float round_square(in vec2 p,in vec2 b,in float r)
float round_square(in vec2 rect,in float r)
{
vec2 b=rect-vec2(r);
vec2 p=vec2(gl_TexCoord[0].xy-screen_size.xy*0.5);
return length(max(abs(p)-b,0.0))-r;
}

vec3 letterbox(in vec2 p,in vec3 c)
vec3 letterbox(in vec3 c)
{
vec2 b=screen_size*0.3625;
float r=screen_size.x*0.2;
float f=round_square(p,b,r);
return c*clamp(1.0-f,0.0,1.0);
vec2 rect=screen_size*0.49;
float r=screen_size.x*0.1;
float f=1.0-clamp(round_square(rect,r),0.0,1.0);
return c*f;
}

void main(void)
@@ -99,6 +102,7 @@ void main(void)
}
color=vec3(color.x*0.875,color.y*1.0,color.z*0.625);
color*=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0); // vignetting
color=letterbox(p,color); // letterbox
//color=vec3(1.0,1.0,1.0);
//color=letterbox(color); // letterbox
gl_FragColor=vec4(color,1.0);
}

Загрузка…
Отмена
Сохранить