1 // Copyright (C) 2008 Till Busch buti@bux.at
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #ifndef CHECKSCENERYVISITOR_HXX
18 #define CHECKSCENERYVISITOR_HXX
20 #include <osg/NodeVisitor>
21 #include <osg/fast_back_stack>
33 // Checks the scene graph for SGPagedLODs that are within range
34 // (compared to postion) and injects them into the DatabasePager.
35 // After visiting, isLoaded() returns true if all models in range
38 class CheckSceneryVisitor : public osg::NodeVisitor
41 CheckSceneryVisitor(osgDB::DatabasePager* dbp, const osg::Vec3 &position, double range, osg::FrameStamp* framestamp);
43 virtual void apply(osg::Node& node);
44 virtual void apply(osg::PagedLOD& node);
45 virtual void apply(osg::Transform& node);
47 bool isLoaded() const {
50 void setLoaded(bool l) {
53 const osg::Vec3 &getPosition() const {
61 osgDB::DatabasePager* _dbp;
62 osg::FrameStamp* _framestamp;
64 osg::fast_back_stack<osg::Matrix> _viewMatrices;