Sfoglia il codice sorgente

COPPERBARS FUCK YEAH

master
parent
commit
8b90645184
7 ha cambiato i file con 75 aggiunte e 56 eliminazioni
  1. +3
    -2
      neercs/Makefile.am
  2. +5
    -6
      neercs/neercs.cpp
  3. +1
    -0
      neercs/neercs.vcxproj
  4. +3
    -0
      neercs/neercs.vcxproj.filters
  5. +1
    -14
      neercs/video/color.lolfx
  6. +60
    -33
      neercs/video/render.cpp
  7. +2
    -1
      neercs/video/render.h

+ 3
- 2
neercs/Makefile.am Vedi File

@@ -11,8 +11,9 @@ neercs_SOURCES = \
video/render.cpp video/render.h \
video/text-render.cpp video/text-render.h \
video/simple.lolfx \
video/blurh.lolfx video/blurv.lolfx video/glow.lolfx video/color.lolfx \
video/remanency.lolfx video/noise.lolfx video/postfx.lolfx\
video/blurh.lolfx video/blurv.lolfx video/glow.lolfx \
video/remanency.lolfx video/copper.lolfx video/color.lolfx \
video/noise.lolfx video/postfx.lolfx \
video/text.lolfx
neercs_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ @CACA_CFLAGS@ -Iold
neercs_LDADD =


+ 5
- 6
neercs/neercs.cpp Vedi File

@@ -86,7 +86,7 @@ void Neercs::TickGame(float seconds)
caca_set_color_argb(m_caca, 0xfff, bg_color);
caca_clear_canvas(m_caca);

caca_set_color_argb(m_caca, 0x545, bg_color);
caca_set_color_argb(m_caca, 0xfff, bg_color);
for(int i = 0; i < h; i++)
{
float a = M_PI / 180 * i * 16 + m_time * 4;
@@ -113,14 +113,13 @@ void Neercs::TickGame(float seconds)
int logo_x = (w - 46) / 2;
int logo_y = h / 2 - 2;

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_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");


+ 1
- 0
neercs/neercs.vcxproj Vedi File

@@ -83,6 +83,7 @@
<LolFxCompile Include="video\blurh.lolfx" />
<LolFxCompile Include="video\blurv.lolfx" />
<LolFxCompile Include="video\glow.lolfx" />
<LolFxCompile Include="video\copper.lolfx" />
<LolFxCompile Include="video\color.lolfx" />
<LolFxCompile Include="video\remanency.lolfx" />
<LolFxCompile Include="video\noise.lolfx" />


+ 3
- 0
neercs/neercs.vcxproj.filters Vedi File

@@ -129,6 +129,9 @@
<LolFxCompile Include="video\glow.lolfx">
<Filter>video</Filter>
</LolFxCompile>
<LolFxCompile Include="video\copper.lolfx">
<Filter>video</Filter>
</LolFxCompile>
<LolFxCompile Include="video\color.lolfx">
<Filter>video</Filter>
</LolFxCompile>


+ 1
- 14
neercs/video/color.lolfx Vedi File

@@ -14,7 +14,6 @@ void main()

uniform sampler2D texture;
uniform vec2 screen_size;
uniform float time;
uniform vec3 filter;
uniform vec3 color;
uniform float flash;
@@ -23,17 +22,6 @@ 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
@@ -42,6 +30,5 @@ void main(void)
c=0.5+(c-0.5)*color.y; // contrast
c+=flash; // flash

//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);
gl_FragColor=vec4(c,1.0);
}

+ 60
- 33
neercs/video/render.cpp Vedi File

@@ -32,10 +32,11 @@ using namespace lol;
#include "text-render.h"

extern char const *lolfx_simple;
extern char const *lolfx_remanency;
extern char const *lolfx_blurh;
extern char const *lolfx_blurv;
extern char const *lolfx_glow;
extern char const *lolfx_remanency;
extern char const *lolfx_copper;
extern char const *lolfx_color;
extern char const *lolfx_noise;
extern char const *lolfx_postfx;
@@ -92,6 +93,7 @@ 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]
vec4 copper(0.125,0.125,32,64); // copper [base,variable,repeat x,repeat y]
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]
@@ -364,14 +366,11 @@ int calc_item_length()
}

Shader *shader_simple;
Shader *shader_remanency;
Shader *shader_blur_h, *shader_blur_v, *shader_glow, *shader_color;
Shader *shader_blur_h, *shader_blur_v, *shader_glow;
Shader *shader_remanency, *shader_copper, *shader_color;
Shader *shader_noise, *shader_postfx;
// shader variables
ShaderUniform shader_simple_texture;
ShaderUniform shader_remanency_source,
shader_remanency_buffer,
shader_remanency_mix;
ShaderUniform shader_blur_h_texture,
shader_blur_h_radius,
shader_blur_v_texture,
@@ -379,9 +378,15 @@ ShaderUniform shader_blur_h_texture,
ShaderUniform shader_glow_glow,
shader_glow_source,
shader_glow_mix;
ShaderUniform shader_remanency_source,
shader_remanency_buffer,
shader_remanency_mix;
ShaderUniform shader_copper_texture,
shader_copper_screen_size,
shader_copper_time,
shader_copper_copper;
ShaderUniform shader_color_texture,
shader_color_screen_size,
shader_color_time,
shader_color_filter,
shader_color_color,
shader_color_flash;
@@ -408,7 +413,7 @@ ShaderUniform shader_postfx_texture,
shader_postfx_sync;

FrameBuffer *fbo_back, *fbo_front, *fbo_buffer;
FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_ping, *fbo_pong;
FrameBuffer *fbo_blur_h, *fbo_blur_v, *fbo_tmp;

TextRender *text_render;

@@ -449,16 +454,10 @@ int Render::InitDraw(void)
fbo_buffer = new FrameBuffer(screen_size);
fbo_blur_h = new FrameBuffer(screen_size);
fbo_blur_v = new FrameBuffer(screen_size);
fbo_ping = new FrameBuffer(screen_size);
fbo_pong = new FrameBuffer(screen_size);
fbo_tmp = new FrameBuffer(screen_size);
// shader simple
shader_simple = Shader::Create(lolfx_simple);
shader_simple_texture = shader_simple->GetUniformLocation("texture");
// shader remanency
shader_remanency = Shader::Create(lolfx_remanency);
shader_remanency_source = shader_remanency->GetUniformLocation("source");
shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer");
shader_remanency_mix = shader_remanency->GetUniformLocation("mix");
// shader glow
shader_glow = Shader::Create(lolfx_glow);
shader_glow_glow = shader_glow->GetUniformLocation("glow");
@@ -472,11 +471,21 @@ int Render::InitDraw(void)
shader_blur_v = Shader::Create(lolfx_blurv);
shader_blur_v_texture = shader_blur_v->GetUniformLocation("texture");
shader_blur_v_radius = shader_blur_v->GetUniformLocation("radius");
// shader remanency
shader_remanency = Shader::Create(lolfx_remanency);
shader_remanency_source = shader_remanency->GetUniformLocation("source");
shader_remanency_buffer = shader_remanency->GetUniformLocation("buffer");
shader_remanency_mix = shader_remanency->GetUniformLocation("mix");
// shader copper
shader_copper = Shader::Create(lolfx_copper);
shader_copper_texture = shader_copper->GetUniformLocation("texture");
shader_copper_screen_size = shader_copper->GetUniformLocation("screen_size");
shader_copper_time = shader_copper->GetUniformLocation("time");
shader_copper_copper = shader_copper->GetUniformLocation("copper");
// shader color
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");
@@ -537,9 +546,10 @@ Render::Render(caca_canvas_t *caca)
m_polygon(true),
m_setup(true),
m_shader(true),
m_shader_remanency(true),
m_shader_glow(true),
m_shader_blur(true),
m_shader_remanency(true),
m_shader_copper(true),
m_shader_color(true),
m_shader_noise(true),
m_shader_postfx(true)
@@ -862,33 +872,51 @@ void Render::Draw3D()
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, fs_quad_tex);

if (m_shader_copper)
{
// shader copper
fbo_tmp->Bind();
shader_copper->Bind();
shader_copper->SetUniform(shader_copper_texture, fbo_back->GetTexture(), 0);
shader_copper->SetUniform(shader_copper_screen_size, (vec2)screen_size);
shader_copper->SetUniform(shader_copper_time, fx_angle);
shader_copper->SetUniform(shader_copper_copper, copper);
fs_quad();
shader_color->Unbind();
fbo_tmp->Unbind();
// shader simple
fbo_back->Bind();
draw_shader_simple(fbo_tmp, 0);
fbo_back->Unbind();
}

if (m_shader_remanency)
{
// shader remanency
fbo_ping->Bind();
fbo_tmp->Bind();
shader_remanency->Bind();
shader_remanency->SetUniform(shader_remanency_source, fbo_back->GetTexture(), 0);
shader_remanency->SetUniform(shader_remanency_buffer, fbo_buffer->GetTexture(), 1);
shader_remanency->SetUniform(shader_remanency_mix, remanency);
fs_quad();
shader_remanency->Unbind();
fbo_ping->Unbind();
fbo_tmp->Unbind();
// shader simple
fbo_back->Bind();
draw_shader_simple(fbo_ping, 0);
draw_shader_simple(fbo_tmp, 0);
fbo_back->Unbind();
// save previous fbo
fbo_ping->Bind();
fbo_tmp->Bind();
shader_remanency->Bind();
shader_remanency->SetUniform(shader_remanency_source, fbo_front->GetTexture(), 0);
shader_remanency->SetUniform(shader_remanency_buffer, fbo_buffer->GetTexture(), 1);
shader_remanency->SetUniform(shader_remanency_mix, buffer);
fs_quad();
shader_remanency->Unbind();
fbo_ping->Unbind();
fbo_tmp->Unbind();
// shader simple
fbo_buffer->Bind();
draw_shader_simple(fbo_ping, 0);
draw_shader_simple(fbo_tmp, 0);
fbo_buffer->Unbind();
}

@@ -948,27 +976,26 @@ void Render::Draw3D()
if (m_shader_color)
{
// shader color
fbo_ping->Bind();
fbo_tmp->Bind();
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);
fs_quad();
shader_color->Unbind();
fbo_ping->Unbind();
fbo_tmp->Unbind();
// shader simple
fbo_front->Bind();
draw_shader_simple(fbo_ping, 0);
draw_shader_simple(fbo_tmp, 0);
fbo_front->Unbind();
}

if (m_shader_noise)
{
// shader noise
fbo_ping->Bind();
fbo_tmp->Bind();
shader_noise->Bind();
shader_noise->SetUniform(shader_noise_texture, fbo_front->GetTexture(), 0);
shader_noise->SetUniform(shader_noise_screen_size, (vec2)screen_size);
@@ -978,27 +1005,27 @@ void Render::Draw3D()
shader_noise->SetUniform(shader_noise_retrace, noise_retrace);
fs_quad();
shader_noise->Unbind();
fbo_ping->Unbind();
fbo_tmp->Unbind();
// shader simple
fbo_front->Bind();
draw_shader_simple(fbo_ping, 0);
draw_shader_simple(fbo_tmp, 0);
fbo_front->Unbind();
}

if (m_shader_blur)
{
// shader blur horizontal
fbo_ping->Bind();
fbo_tmp->Bind();
shader_blur_h->Bind();
shader_blur_h->SetUniform(shader_blur_h_texture, fbo_front->GetTexture(), 0);
shader_blur_h->SetUniform(shader_blur_h_radius, blur / screen_size.x);
fs_quad();
shader_blur_h->Unbind();
fbo_ping->Unbind();
fbo_tmp->Unbind();
// shader blur vertical
fbo_front->Bind();
shader_blur_v->Bind();
shader_blur_v->SetUniform(shader_blur_v_texture, fbo_ping->GetTexture(), 0);
shader_blur_v->SetUniform(shader_blur_v_texture, fbo_tmp->GetTexture(), 0);
shader_blur_v->SetUniform(shader_blur_v_radius, blur / screen_size.y);
fs_quad();
shader_blur_v->Unbind();


+ 2
- 1
neercs/video/render.h Vedi File

@@ -33,9 +33,10 @@ private:
bool m_polygon;
bool m_setup;
bool m_shader;
bool m_shader_remanency;
bool m_shader_glow;
bool m_shader_blur;
bool m_shader_remanency;
bool m_shader_copper;
bool m_shader_color;
bool m_shader_noise;
bool m_shader_postfx;


Caricamento…
Annulla
Salva