mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 12:32:40 +02:00
Revert "Remove Renderer
field from GraphicsFunContext"
This reverts commit9f02999947
&2c55a8a9d9
This commit is contained in:
@@ -176,10 +176,9 @@ void Renderer::render_parts()
|
|||||||
auto &elements = sd.elements;
|
auto &elements = sd.elements;
|
||||||
auto &graphicscache = sd.graphicscache;
|
auto &graphicscache = sd.graphicscache;
|
||||||
GraphicsFuncContext gfctx;
|
GraphicsFuncContext gfctx;
|
||||||
|
gfctx.ren = this;
|
||||||
gfctx.sim = sim;
|
gfctx.sim = sim;
|
||||||
gfctx.rng.seed(rng());
|
gfctx.rng.seed(rng());
|
||||||
gfctx.decorationsEnable = decorations_enable;
|
|
||||||
gfctx.blackDecorations = blackDecorations;
|
|
||||||
gfctx.pipeSubcallCpart = nullptr;
|
gfctx.pipeSubcallCpart = nullptr;
|
||||||
gfctx.pipeSubcallTpart = nullptr;
|
gfctx.pipeSubcallTpart = nullptr;
|
||||||
int deca, decr, decg, decb, cola, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, q, i, t, nx, ny, x, y;
|
int deca, decr, decg, decb, cola, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, q, i, t, nx, ny, x, y;
|
||||||
|
@@ -18,9 +18,8 @@ struct Particle;
|
|||||||
|
|
||||||
struct GraphicsFuncContext
|
struct GraphicsFuncContext
|
||||||
{
|
{
|
||||||
|
const Renderer *ren;
|
||||||
const Simulation *sim;
|
const Simulation *sim;
|
||||||
bool decorationsEnable;
|
|
||||||
bool blackDecorations;
|
|
||||||
RNG rng;
|
RNG rng;
|
||||||
const Particle *pipeSubcallCpart;
|
const Particle *pipeSubcallCpart;
|
||||||
Particle *pipeSubcallTpart;
|
Particle *pipeSubcallTpart;
|
||||||
|
@@ -100,9 +100,9 @@ static int graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool deco = false;
|
bool deco = false;
|
||||||
if (gfctx.decorationsEnable && cpart->dcolour && (cpart->dcolour&0xFF000000))
|
if (gfctx.ren->decorations_enable && cpart->dcolour && (cpart->dcolour&0xFF000000))
|
||||||
{
|
{
|
||||||
if (!gfctx.blackDecorations) // if blackDecorations is off, always show deco
|
if (!gfctx.ren->blackDecorations) // if blackDecorations is off, always show deco
|
||||||
deco = true;
|
deco = true;
|
||||||
else if (((cpart->dcolour>>24)&0xFF) >= 250 && ((cpart->dcolour>>16)&0xFF) <= 5 && ((cpart->dcolour>>8)&0xFF) <= 5 && ((cpart->dcolour)&0xFF) <= 5) // else only render black deco
|
else if (((cpart->dcolour>>24)&0xFF) >= 250 && ((cpart->dcolour>>16)&0xFF) <= 5 && ((cpart->dcolour>>8)&0xFF) <= 5 && ((cpart->dcolour)&0xFF) <= 5) // else only render black deco
|
||||||
deco = true;
|
deco = true;
|
||||||
|
@@ -107,9 +107,9 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
bool deco = false;
|
bool deco = false;
|
||||||
if (gfctx.decorationsEnable && cpart->dcolour && (cpart->dcolour&0xFF000000))
|
if (gfctx.ren->decorations_enable && cpart->dcolour && (cpart->dcolour&0xFF000000))
|
||||||
{
|
{
|
||||||
if (!gfctx.blackDecorations) // if blackDecorations is off, always show deco
|
if (!gfctx.ren->blackDecorations) // if blackDecorations is off, always show deco
|
||||||
deco = true;
|
deco = true;
|
||||||
else if(((cpart->dcolour>>24)&0xFF) >= 250 && ((cpart->dcolour>>16)&0xFF) <= 5 && ((cpart->dcolour>>8)&0xFF) <= 5 && ((cpart->dcolour)&0xFF) <= 5) // else only render black deco
|
else if(((cpart->dcolour>>24)&0xFF) >= 250 && ((cpart->dcolour>>16)&0xFF) <= 5 && ((cpart->dcolour>>8)&0xFF) <= 5 && ((cpart->dcolour)&0xFF) <= 5) // else only render black deco
|
||||||
deco = true;
|
deco = true;
|
||||||
|
@@ -58,10 +58,10 @@ static int graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
colour1 = 0xFFFFFF_rgb;
|
colour1 = 0xFFFFFF_rgb;
|
||||||
}
|
}
|
||||||
auto ruleset = cpart->ctype;
|
auto ruleset = cpart->ctype;
|
||||||
bool renderDeco = !gfctx.blackDecorations;
|
bool renderDeco = !gfctx.ren->blackDecorations;
|
||||||
if (ruleset >= 0 && ruleset < NGOL)
|
if (ruleset >= 0 && ruleset < NGOL)
|
||||||
{
|
{
|
||||||
if (!renderDeco || !gfctx.decorationsEnable)
|
if (!renderDeco || !gfctx.ren->decorations_enable)
|
||||||
{
|
{
|
||||||
colour1 = builtinGol[ruleset].colour;
|
colour1 = builtinGol[ruleset].colour;
|
||||||
colour2 = builtinGol[ruleset].colour2;
|
colour2 = builtinGol[ruleset].colour2;
|
||||||
|
Reference in New Issue
Block a user