Skip to content

Commit

Permalink
Clean up some unneeded methods on PointFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Jun 1, 2021
1 parent 7913c05 commit e3238ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
26 changes: 10 additions & 16 deletions radiantcore/map/PointFile.cpp
Expand Up @@ -31,7 +31,12 @@ PointFile::PointFile() :
_points(GL_LINE_STRIP),
_curPos(0)
{
registerCommands();
GlobalCommandSystem().addCommand(
"NextLeakSpot", sigc::mem_fun(*this, &PointFile::nextLeakSpot)
);
GlobalCommandSystem().addCommand(
"PrevLeakSpot", sigc::mem_fun(*this, &PointFile::prevLeakSpot)
);
}

PointFile::~PointFile()
Expand All @@ -42,7 +47,7 @@ void PointFile::onMapEvent(IMap::MapEvent ev)
{
if (ev == IMap::MapUnloading || ev == IMap::MapSaved)
{
clear();
show({});
}
}

Expand All @@ -60,8 +65,8 @@ void PointFile::show(const fs::path& pointfile)
parse(pointfile);

// Construct shader if needed, and activate rendering
if (!_renderstate)
_renderstate = GlobalRenderSystem().capture("$POINTFILE");
if (!_shader)
_shader = GlobalRenderSystem().capture("$POINTFILE");
GlobalRenderSystem().attachRenderable(*this);
}
else if (isVisible())
Expand All @@ -81,7 +86,7 @@ void PointFile::renderSolid(RenderableCollector& collector, const VolumeTest& vo
{
if (isVisible())
{
collector.addRenderable(*_renderstate, _points, Matrix4::getIdentity());
collector.addRenderable(*_shader, _points, Matrix4::getIdentity());
}
}

Expand Down Expand Up @@ -177,15 +182,4 @@ void PointFile::prevLeakSpot(const cmd::ArgumentList& args)
advance(false);
}

void PointFile::clear()
{
show({});
}

void PointFile::registerCommands()
{
GlobalCommandSystem().addCommand("NextLeakSpot", sigc::mem_fun(*this, &PointFile::nextLeakSpot));
GlobalCommandSystem().addCommand("PrevLeakSpot", sigc::mem_fun(*this, &PointFile::prevLeakSpot));
}

} // namespace map
10 changes: 2 additions & 8 deletions radiantcore/map/PointFile.h
Expand Up @@ -20,7 +20,8 @@ class PointFile: public Renderable
// Holds the current position in the point file chain
std::size_t _curPos;

ShaderPtr _renderstate;
// The shader for rendering the line
ShaderPtr _shader;

public:
// Constructor
Expand Down Expand Up @@ -56,13 +57,6 @@ class PointFile: public Renderable
void show(const fs::path& pointfile);

private:
// Registers the events to the EventManager
void registerCommands();

/**
* greebo: Clears the point file vector, which is the same as hiding it.
*/
void clear();

/**
* greebo: This sets the camera position to the next/prev leak spot.
Expand Down

0 comments on commit e3238ac

Please sign in to comment.