3 * Copyright (C) 2008 Tim Moore
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 #ifndef SIMGEAR_NODEANDDRAWABLEVISITOR_HXX
22 #define SIMGEAR_NODEANDDRAWABLEVISITOR_HXX 1
24 #include <osg/Drawable>
25 #include <osg/NodeVisitor>
29 /** A node visitor that descends into Drawables too.
31 class NodeAndDrawableVisitor : public osg::NodeVisitor
34 NodeAndDrawableVisitor(osg::NodeVisitor::TraversalMode tm);
35 NodeAndDrawableVisitor(osg::NodeVisitor::VisitorType type,
36 osg::NodeVisitor::TraversalMode tm);
37 virtual ~NodeAndDrawableVisitor();
38 using osg::NodeVisitor::apply;
39 virtual void apply(osg::Node& node);
40 /** Visit a Drawable node. Note that you cannot write an apply()
41 method with an argument that is a subclass of Drawable and expect
42 it to be called, because this visitor can't add the double dispatch
43 machinery of NodeVisitor to the existing OSG Drawable subclasses.
45 virtual void apply(osg::Drawable& drawable);
46 // hides NodeVisitor::traverse
47 void traverse(osg::Node& node);