]> git.mxchange.org Git - simgear.git/blob - simgear/scene/util/NodeAndDrawableVisitor.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / util / NodeAndDrawableVisitor.hxx
1 /* -*-c++-*-
2  *
3  * Copyright (C) 2008 Tim Moore
4  *
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.
9  *
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.
14  *
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,
18  * MA 02110-1301, USA.
19  *
20  */
21 #ifndef SIMGEAR_NODEANDDRAWABLEVISITOR_HXX
22 #define SIMGEAR_NODEANDDRAWABLEVISITOR_HXX 1
23
24 #include <osg/Drawable>
25 #include <osg/NodeVisitor>
26
27 namespace simgear
28 {
29 /** A node visitor that descends into Drawables too.
30  */
31 class NodeAndDrawableVisitor : public osg::NodeVisitor
32 {
33 public:
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.
44     */
45     virtual void apply(osg::Drawable& drawable);
46     // hides NodeVisitor::traverse
47     void traverse(osg::Node& node);
48 };
49
50 }
51 #endif