]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/CheckSceneryVisitor.hxx
Add preliminary spot light animation
[simgear.git] / simgear / scene / model / CheckSceneryVisitor.hxx
1 // Copyright (C) 2008 Till Busch buti@bux.at
2 // Copyright (C) 2011 Mathias Froehlich
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
18 #ifndef CHECKSCENERYVISITOR_HXX
19 #define CHECKSCENERYVISITOR_HXX
20
21 #include <osg/NodeVisitor>
22
23 namespace osgDB {
24 class DatabasePager;
25 }
26
27
28 namespace simgear
29 {
30
31 // Checks the scene graph for PagedLOD or ProxyNodes that are within range
32 // (compared to postion) and injects them into the DatabasePager.
33 // After visiting, isLoaded() returns true if all models in range
34 // are available.
35
36 class CheckSceneryVisitor : public osg::NodeVisitor
37 {
38 public:
39     CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range, osg::FrameStamp* framestamp);
40
41     virtual void apply(osg::Node& node);
42     virtual void apply(osg::ProxyNode& node);
43     virtual void apply(osg::PagedLOD& node);
44     virtual void apply(osg::Transform& node);
45
46     bool isLoaded() const {
47         return _loaded;
48     }
49     void setLoaded(bool l) {
50         _loaded=l;
51     }
52     const osg::Vec3 &getPosition() const {
53         return _position;
54     }
55
56 private:
57     osg::Vec3 _position;
58     double _range;
59     bool _loaded;
60     osg::Matrix _matrix;
61 };
62
63 }
64
65 #endif