Persistent mode

This commit is contained in:
Simon Robertshaw
2012-08-09 00:57:35 +01:00
parent d352a10d80
commit bb99efdedf
2 changed files with 313 additions and 286 deletions

View File

@@ -24,8 +24,8 @@ extern "C"
}
#ifndef OGLI
#define VIDXRES XRES+BARSIZE
#define VIDYRES YRES+MENUSIZE
#define VIDXRES (XRES+BARSIZE)
#define VIDYRES (YRES+MENUSIZE)
#else
#define VIDXRES XRES
#define VIDYRES YRES
@@ -37,11 +37,35 @@ extern "C"
void Renderer::RenderBegin()
{
#ifndef OGLR
if(display_mode & DISPLAY_PERS)
{
std::copy(persistentVid, persistentVid+(VIDXRES*YRES), vid);
}
#endif
draw_air();
draw_grav();
render_parts();
render_fire();
#ifndef OGLR
if(display_mode & DISPLAY_PERS)
{
int i,r,g,b;
for (i = 0; i < VIDXRES*YRES; i++)
{
r = PIXR(vid[i]);
g = PIXG(vid[i]);
b = PIXB(vid[i]);
if (r>0)
r--;
if (g>0)
g--;
if (b>0)
b--;
persistentVid[i] = PIXRGB(r,g,b);
}
}
#endif
DrawWalls();
draw_grav_zones();
DrawSigns();
@@ -2146,6 +2170,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
#else
vid = g->vid;
#endif
persistentVid = new pixel[VIDXRES*YRES];
#endif
memset(fire_r, 0, sizeof(fire_r));
@@ -2325,6 +2350,7 @@ void Renderer::ClearAccumulation()
std::fill(fire_r[0]+0, fire_r[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
std::fill(fire_g[0]+0, fire_g[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
std::fill(fire_b[0]+0, fire_b[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
std::fill(persistentVid, persistentVid+(VIDXRES*YRES), 0);
}
void Renderer::AddRenderMode(unsigned int mode)

View File

@@ -87,6 +87,7 @@ public:
void loadShaders();
#else
pixel * vid;
pixel * persistentVid;
void blendpixel(int x, int y, int r, int g, int b, int a);
void addpixel(int x, int y, int r, int g, int b, int a);