Explorar el Código

remanency buffer now use ONLY ONE buffer / renamed font map, added a new one (dos) / fixed the ASCII logo

master
rez Sam Hocevar <sam@hocevar.net> hace 12 años
padre
commit
bcfa593af3
Se han modificado 7 ficheros con 34 adiciones y 53 borrados
  1. +9
    -9
      neercs/neercs.cpp
  2. +3
    -7
      neercs/video/remanency.lolfx
  3. +21
    -36
      neercs/video/render.cpp
  4. BIN
      neercs/video/resource/charset_amiga.png
  5. BIN
      neercs/video/resource/charset_dos.png
  6. BIN
      neercs/video/resource/map.png
  7. +1
    -1
      neercs/video/text-render.cpp

+ 9
- 9
neercs/neercs.cpp Ver fichero

@@ -92,23 +92,23 @@ void Neercs::TickGame(float seconds)
}

/*
.___ __ ______ ______ ______ ______ ______,
\° \| /° __ \° __ \° __ \/° ___//° ___/
/ ` > ____/ ____/ ,_ <_ <____\___ \
/__/\___\______\______\__| \__/_____________\
__ _________ ______ _____ ______ ______
/ \/ / __ Y __ Y __ \/ ___// ___/
/ / ____/ ____/ __ < <____\___ \
/__/\__/\_______________/ \________________\
*/

int logo_x = (w - 45) / 2;
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_put_str(m_caca, logo_x, logo_y ,".___ __ ______ ______ ______ ______ ______,");
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_put_str(m_caca, logo_x, logo_y + 1, " \\° \\| /° __ \\° __ \\° __ \\/° ___//° ___/");
caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/ \\/ / __ Y __ Y __ \\/ ___// ___/");
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, logo_y + 2, " / ` > ____/ ____/ ,_ <_ <____\\___ \\");
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_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 + 5, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US");



+ 3
- 7
neercs/video/remanency.lolfx Ver fichero

@@ -13,9 +13,7 @@ void main()
#version 120

uniform sampler2D texture;
uniform sampler2D texture_buffer1;
uniform sampler2D texture_buffer2;
uniform sampler2D texture_buffer3;
uniform sampler2D texture_buffer;
uniform vec2 screen_size;
uniform float time;
uniform float value1;
@@ -25,9 +23,7 @@ void main(void)
{
vec2 p=gl_TexCoord[0].xy;
vec4 source=texture2D(texture,p);
vec4 buffer1=texture2D(texture_buffer1,p);
vec4 buffer2=texture2D(texture_buffer2,p);
vec4 buffer3=texture2D(texture_buffer3,p);
vec4 color=source*value1+buffer1*value2+buffer2*value2+buffer3*value2;
vec4 buffer=texture2D(texture_buffer,p);
vec4 color=source*value1+buffer*value2;
gl_FragColor=color;
}

+ 21
- 36
neercs/video/render.cpp Ver fichero

@@ -116,9 +116,7 @@ ShaderUniform shader_blur_v_texture,
shader_blur_v_time,
shader_blur_v_value;
ShaderUniform shader_remanency_texture,
shader_remanency_texture_buffer1,
shader_remanency_texture_buffer2,
shader_remanency_texture_buffer3,
shader_remanency_texture_buffer,
shader_remanency_screen_size,
shader_remanency_time,
shader_remanency_value1,
@@ -146,8 +144,7 @@ ShaderUniform shader_postfx_texture,
shader_postfx_scanline,
shader_postfx_sync;

FrameBuffer *fbo_back, *fbo_front;
FrameBuffer *fbo_buffer1, *fbo_buffer2, *fbo_buffer3, *fbo_buffer4, *fbo_buffer5, *fbo_buffer6;
FrameBuffer *fbo_back, *fbo_front, *fbo_buffer;
FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_ping, *fbo_pong;

TextRender *text_render;
@@ -186,12 +183,7 @@ int Render::InitDraw(void)
/* Initialise framebuffer objects */
fbo_back = new FrameBuffer(screen_size);
fbo_front = new FrameBuffer(screen_size);
fbo_buffer1 = new FrameBuffer(screen_size);
fbo_buffer2 = new FrameBuffer(screen_size);
fbo_buffer3 = new FrameBuffer(screen_size);
fbo_buffer4 = new FrameBuffer(screen_size);
fbo_buffer5 = new FrameBuffer(screen_size);
fbo_buffer6 = new FrameBuffer(screen_size);
fbo_buffer = new FrameBuffer(screen_size);
fbo_blur_h = new FrameBuffer(screen_size / glow_fbo_size);
fbo_blur_v = new FrameBuffer(screen_size / glow_fbo_size);
fbo_ping = new FrameBuffer(screen_size);
@@ -214,9 +206,7 @@ int Render::InitDraw(void)
// shader remanency
shader_remanency = Shader::Create(lolfx_remanency);
shader_remanency_texture = shader_remanency->GetUniformLocation("texture");
shader_remanency_texture_buffer1 = shader_remanency->GetUniformLocation("texture_buffer1");
shader_remanency_texture_buffer2 = shader_remanency->GetUniformLocation("texture_buffer2");
shader_remanency_texture_buffer3 = shader_remanency->GetUniformLocation("texture_buffer3");
shader_remanency_texture_buffer = shader_remanency->GetUniformLocation("texture_buffer");
shader_remanency_screen_size = shader_remanency->GetUniformLocation("screen_size");
shader_remanency_time = shader_remanency->GetUniformLocation("time");
shader_remanency_value1 = shader_remanency->GetUniformLocation("value1");
@@ -440,13 +430,11 @@ void Render::Draw3D()
fbo_ping->Bind();
shader_remanency->Bind();
shader_remanency->SetTexture(shader_remanency_texture, fbo_back->GetTexture(), 0);
shader_remanency->SetTexture(shader_remanency_texture_buffer1, fbo_buffer2->GetTexture(), 1);
shader_remanency->SetTexture(shader_remanency_texture_buffer2, fbo_buffer4->GetTexture(), 2);
shader_remanency->SetTexture(shader_remanency_texture_buffer3, fbo_buffer6->GetTexture(), 3);
shader_remanency->SetTexture(shader_remanency_texture_buffer, fbo_buffer->GetTexture(), 1);
shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
shader_remanency->SetUniform(shader_remanency_time, fx_angle);
shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
shader_remanency->SetUniform(shader_remanency_value2, 0.25f);
shader_remanency->SetUniform(shader_remanency_value2, 0.75f);
fs_quad();
shader_remanency->Unbind();
fbo_ping->Unbind();
@@ -455,24 +443,21 @@ void Render::Draw3D()
draw_shader_simple(fbo_ping, 0);
fbo_back->Unbind();
// save previous fbo
fbo_buffer6->Bind();
draw_shader_simple(fbo_buffer5, 0);
fbo_buffer6->Unbind();
fbo_buffer5->Bind();
draw_shader_simple(fbo_buffer4, 0);
fbo_buffer5->Unbind();
fbo_buffer4->Bind();
draw_shader_simple(fbo_buffer3, 0);
fbo_buffer4->Unbind();
fbo_buffer3->Bind();
draw_shader_simple(fbo_buffer2, 0);
fbo_buffer3->Unbind();
fbo_buffer2->Bind();
draw_shader_simple(fbo_buffer1, 0);
fbo_buffer2->Unbind();
fbo_buffer1->Bind();
draw_shader_simple(fbo_front, 0);
fbo_buffer1->Unbind();
fbo_ping->Bind();
shader_remanency->Bind();
shader_remanency->SetTexture(shader_remanency_texture, fbo_front->GetTexture(), 0);
shader_remanency->SetTexture(shader_remanency_texture_buffer, fbo_buffer->GetTexture(), 1);
shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
shader_remanency->SetUniform(shader_remanency_time, fx_angle);
shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
shader_remanency->SetUniform(shader_remanency_value2, 0.75f);
fs_quad();
shader_remanency->Unbind();
fbo_ping->Unbind();
// shader simple
fbo_buffer->Bind();
draw_shader_simple(fbo_ping, 0);
fbo_buffer->Unbind();
}

if (m_shader_fx && m_shader_blur)


BIN
neercs/video/resource/charset_amiga.png Ver fichero

Antes Después
Anchura: 256  |  Altura: 256  |  Tamaño: 3.9 KiB

BIN
neercs/video/resource/charset_dos.png Ver fichero

Antes Después
Anchura: 256  |  Altura: 256  |  Tamaño: 4.6 KiB

BIN
neercs/video/resource/map.png Ver fichero

Antes Después
Anchura: 256  |  Altura: 256  |  Tamaño: 2.0 KiB

+ 1
- 1
neercs/video/text-render.cpp Ver fichero

@@ -40,7 +40,7 @@ TextRender::TextRender(caca_canvas_t *caca, ivec2 font_size)

void TextRender::Init()
{
m_font = new TileSet("tools/neercs/video/resource/map.png",
m_font = new TileSet("tools/neercs/video/resource/charset_amiga.png",
ivec2(256, 256), ivec2(1));

m_shader = Shader::Create(lolfx_text);


Cargando…
Cancelar
Guardar