Skip to content

Commit

Permalink
Issue #94 Adds Reset to NodeVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
DieSlower committed Feb 7, 2019
1 parent 5c274cc commit 2fc3ab1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/trCore/Nodes/NodeVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ namespace trCore::Nodes
*/
virtual const osg::NodeVisitor* AsOSGVisitor() const;

/**
* @fn virtual void NodeVisitor::Reset();
*
* @brief Method to call to reset visitor. Useful if your visitor accumulates state during a
* traversal, and you plan to reuse the visitor. To flush that state for the next
* traversal: call reset() prior to each traversal.
*/
virtual void Reset();

protected:

trBase::SmrtPtr<osg::NodeVisitor> mNodeVisitor;
Expand Down
6 changes: 6 additions & 0 deletions src/trCore/Nodes/NodeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ namespace trCore::Nodes
return mNodeVisitor.Get();
}

//////////////////////////////////////////////////////////////////////////
void NodeVisitor::Reset()
{
mNodeVisitor->reset();
}

//////////////////////////////////////////////////////////////////////////
NodeVisitor::~NodeVisitor()
{
Expand Down

0 comments on commit 2fc3ab1

Please sign in to comment.