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