mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-15 03:39:56 +01:00
Gravity lensing
This commit is contained in:
parent
bb99efdedf
commit
3bdfd510b2
@ -42,6 +42,13 @@ void Renderer::RenderBegin()
|
||||
{
|
||||
std::copy(persistentVid, persistentVid+(VIDXRES*YRES), vid);
|
||||
}
|
||||
pixel * oldVid;
|
||||
if(display_mode & DISPLAY_WARP)
|
||||
{
|
||||
oldVid = vid;
|
||||
vid = warpVid;
|
||||
std::fill(warpVid, warpVid+(VIDXRES*VIDYRES), 0);
|
||||
}
|
||||
#endif
|
||||
draw_air();
|
||||
draw_grav();
|
||||
@ -69,6 +76,12 @@ void Renderer::RenderBegin()
|
||||
DrawWalls();
|
||||
draw_grav_zones();
|
||||
DrawSigns();
|
||||
#ifndef OGLR
|
||||
if(display_mode & DISPLAY_WARP)
|
||||
{
|
||||
vid = oldVid;
|
||||
}
|
||||
#endif
|
||||
#ifndef OGLR
|
||||
FinaliseParts();
|
||||
#endif
|
||||
@ -292,9 +305,16 @@ void Renderer::FinaliseParts()
|
||||
}
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
#elif defined(OGLI)
|
||||
#endif
|
||||
|
||||
#if defined(OGLI) && !defined(OGLR)
|
||||
render_gravlensing(warpVid);
|
||||
g->draw_image(vid, 0, 0, VIDXRES, VIDYRES, 255);
|
||||
#endif
|
||||
|
||||
#if !defined(OGLR) && !defined(OGLI)
|
||||
render_gravlensing(warpVid);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Renderer::RenderZoom()
|
||||
@ -775,13 +795,13 @@ void Renderer::DrawSigns()
|
||||
#endif
|
||||
}
|
||||
|
||||
void Renderer::render_gravlensing()
|
||||
void Renderer::render_gravlensing(pixel * source)
|
||||
{
|
||||
#ifndef OGLR
|
||||
int nx, ny, rx, ry, gx, gy, bx, by, co;
|
||||
int r, g, b;
|
||||
pixel t;
|
||||
pixel *src = vid;
|
||||
pixel *src = source;
|
||||
pixel *dst = vid;
|
||||
for(nx = 0; nx < XRES; nx++)
|
||||
{
|
||||
@ -2171,6 +2191,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
|
||||
vid = g->vid;
|
||||
#endif
|
||||
persistentVid = new pixel[VIDXRES*YRES];
|
||||
warpVid = new pixel[VIDXRES*VIDYRES];
|
||||
#endif
|
||||
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
void RenderZoom();
|
||||
void DrawWalls();
|
||||
void DrawSigns();
|
||||
void render_gravlensing();
|
||||
void render_gravlensing(pixel * source);
|
||||
void render_fire();
|
||||
void prepare_alpha(int size, float intensity);
|
||||
void render_parts();
|
||||
@ -88,6 +88,7 @@ public:
|
||||
#else
|
||||
pixel * vid;
|
||||
pixel * persistentVid;
|
||||
pixel * warpVid;
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user