Refactor various NodeTracker and MatrixManipulator classes to use the osg::ObserverNodePath and osg::oberserver_ptr<> classes
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <osg/Node>
|
||||
#include <osg/NodeCallback>
|
||||
#include <osg/observer_ptr>
|
||||
#include <osg/ObserverNodePath>
|
||||
|
||||
namespace osg
|
||||
{
|
||||
@@ -27,22 +27,15 @@ class OSG_EXPORT NodeTrackerCallback : public NodeCallback
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef std::vector< observer_ptr<Node> > ObserverNodePath;
|
||||
|
||||
void setTrackNodePath(const osg::NodePath& nodePath)
|
||||
{
|
||||
_trackNodePath.clear();
|
||||
_trackNodePath.reserve(nodePath.size());
|
||||
std::copy(nodePath.begin(), nodePath.end(), std::back_inserter(_trackNodePath));
|
||||
}
|
||||
void setTrackNodePath(const osg::NodePath& nodePath) { _trackNodePath.setNodePath(nodePath); }
|
||||
|
||||
void setTrackNodePath(const ObserverNodePath& nodePath) { _trackNodePath = nodePath; }
|
||||
|
||||
ObserverNodePath& getTrackNodePath() { return _trackNodePath; }
|
||||
|
||||
void setTrackNode(osg::Node* node);
|
||||
osg::Node* getTrackNode() { return _trackNodePath.empty() ? 0 : _trackNodePath.back().get(); }
|
||||
const osg::Node* getTrackNode() const { return _trackNodePath.empty() ? 0 : _trackNodePath.back().get(); }
|
||||
osg::Node* getTrackNode();
|
||||
const osg::Node* getTrackNode() const;
|
||||
|
||||
/** Implements the callback. */
|
||||
virtual void operator()(Node* node, NodeVisitor* nv);
|
||||
@@ -50,9 +43,6 @@ class OSG_EXPORT NodeTrackerCallback : public NodeCallback
|
||||
/** Update the node to track the nodepath.*/
|
||||
void update(osg::Node& node);
|
||||
|
||||
|
||||
bool validateNodePath() const;
|
||||
|
||||
protected:
|
||||
|
||||
ObserverNodePath _trackNodePath;
|
||||
|
||||
Reference in New Issue
Block a user