root/OpenSceneGraph/trunk/include/osg/NodeTrackerCallback @ 7102

Revision 7102, 1.9 kB (checked in by robert, 6 years ago)

Fixed typo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
14#ifndef OSG_NODETRACKERCALLBACK
15#define OSG_NODETRACKERCALLBACK 1
16
17#include <osg/Node>
18#include <osg/NodeCallback>
19#include <osg/observer_ptr>
20
21namespace osg
22{
23
24class OSG_EXPORT NodeTrackerCallback : public NodeCallback
25{
26    public:
27
28
29        typedef std::vector< observer_ptr<Node> >   ObserverNodePath;
30
31        void setTrackNodePath(const osg::NodePath& nodePath)
32        {
33           _trackNodePath.clear();
34           _trackNodePath.reserve(nodePath.size());
35           std::copy(nodePath.begin(), nodePath.end(), std::back_inserter(_trackNodePath));
36        }
37
38        void setTrackNodePath(const ObserverNodePath& nodePath) { _trackNodePath = nodePath; }
39        ObserverNodePath& getTrackNodePath() { return _trackNodePath; }
40
41        void setTrackNode(osg::Node* node);
42        osg::Node* getTrackNode() { return _trackNodePath.empty() ? 0 : _trackNodePath.back().get(); }
43        const osg::Node* getTrackNode() const { return _trackNodePath.empty() ? 0 : _trackNodePath.back().get(); }
44
45        /** Implements the callback. */
46        virtual void operator()(Node* node, NodeVisitor* nv);
47
48        /** Update the node to track the nodepath.*/
49        void update(osg::Node& node);
50
51
52        bool validateNodePath() const;
53
54    protected:
55
56        ObserverNodePath _trackNodePath;
57
58};
59
60}
61
62#endif
Note: See TracBrowser for help on using the browser.