mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-16 22:08:28 +01:00
Fix find mode always reporting 0 particles found
Somehow foundElements (now renamed to foundParticles) made it into RendererSettings in 820f44a71690, even though it's actually a result of the rendering process. It is now extracted the same way as the resulting frame.
This commit is contained in:
parent
65aa34201b
commit
6da42933c4
@ -262,7 +262,7 @@ void Renderer::render_parts()
|
||||
BlendPixel({ nx, ny }, 0x646464_rgb .WithAlpha(80));
|
||||
}
|
||||
}
|
||||
foundElements = 0;
|
||||
foundParticles = 0;
|
||||
for(i = 0; i<=sim->parts_lastActiveIndex; i++) {
|
||||
if (sim->parts[i].type && sim->parts[i].type >= 0 && sim->parts[i].type < PT_NUM) {
|
||||
t = sim->parts[i].type;
|
||||
@ -483,7 +483,7 @@ void Renderer::render_parts()
|
||||
{
|
||||
colr = firer = 255;
|
||||
colg = fireg = colb = fireb = 0;
|
||||
foundElements++;
|
||||
foundParticles++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ class Renderer : private RendererSettings, public RasterDrawMethods<Renderer>
|
||||
RendererFrame video;
|
||||
std::array<pixel, WINDOW.X * RES.Y> persistentVideo;
|
||||
RendererFrame warpVideo;
|
||||
int foundParticles = 0;
|
||||
|
||||
Rect<int> GetClipRect() const
|
||||
{
|
||||
@ -72,6 +73,11 @@ public:
|
||||
return video;
|
||||
}
|
||||
|
||||
int GetFoundParticles() const
|
||||
{
|
||||
return foundParticles;
|
||||
}
|
||||
|
||||
const RenderableSimulation *sim = nullptr;
|
||||
|
||||
struct GradientStop
|
||||
|
@ -21,7 +21,6 @@ struct RendererSettings
|
||||
};
|
||||
DecorationLevel decorationLevel = decorationEnabled;
|
||||
bool debugLines = false;
|
||||
int foundElements = 0;
|
||||
ui::Point mousePos = { 0, 0 };
|
||||
int gridSize = 0;
|
||||
float fireIntensity = 1;
|
||||
|
@ -2159,6 +2159,7 @@ void GameView::OnDraw()
|
||||
{
|
||||
StartRendererThread();
|
||||
WaitForRendererThread();
|
||||
foundParticles = ren->GetFoundParticles();
|
||||
*rendererThreadResult = ren->GetVideo();
|
||||
rendererFrame = rendererThreadResult.get();
|
||||
DispatchRendererThread();
|
||||
@ -2168,6 +2169,7 @@ void GameView::OnDraw()
|
||||
PauseRendererThread();
|
||||
ren->ApplySettings(*rendererSettings);
|
||||
RenderSimulation(*sim, true);
|
||||
foundParticles = ren->GetFoundParticles();
|
||||
rendererFrame = &ren->GetVideo();
|
||||
}
|
||||
|
||||
@ -2514,7 +2516,7 @@ void GameView::OnDraw()
|
||||
if (showDebug)
|
||||
{
|
||||
if (rendererSettings->findingElement)
|
||||
fpsInfo << " Parts: " << rendererSettings->foundElements << "/" << sample.NumParts;
|
||||
fpsInfo << " Parts: " << foundParticles << "/" << sample.NumParts;
|
||||
else
|
||||
fpsInfo << " Parts: " << sample.NumParts;
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ private:
|
||||
void DispatchRendererThread();
|
||||
std::unique_ptr<RenderableSimulation> rendererThreadSim;
|
||||
std::unique_ptr<RendererFrame> rendererThreadResult;
|
||||
int foundParticles = 0;
|
||||
const RendererFrame *rendererFrame = nullptr;
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user