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

Revision 10764, 1.9 kB (checked in by robert, 4 years ago)

<iterator>, <stdlib.h> and <ctype.h> includes required for QNX compiler

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