NodeTrackerCallback 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSG_NODETRACKERCALLBACK
  14. #define OSG_NODETRACKERCALLBACK 1
  15. #include <iterator>
  16. #include <osg/Node>
  17. #include <osg/ObserverNodePath>
  18. namespace osg
  19. {
  20. class OSG_EXPORT NodeTrackerCallback : public NodeCallback
  21. {
  22. public:
  23. void setTrackNodePath(const osg::NodePath& nodePath) { _trackNodePath.setNodePath(nodePath); }
  24. void setTrackNodePath(const ObserverNodePath& nodePath) { _trackNodePath = nodePath; }
  25. ObserverNodePath& getTrackNodePath() { return _trackNodePath; }
  26. void setTrackNode(osg::Node* node);
  27. osg::Node* getTrackNode();
  28. const osg::Node* getTrackNode() const;
  29. /** Implements the callback. */
  30. virtual void operator()(Node* node, NodeVisitor* nv);
  31. /** Update the node to track the nodepath.*/
  32. void update(osg::Node& node);
  33. protected:
  34. ObserverNodePath _trackNodePath;
  35. };
  36. }
  37. #endif