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 SGPAGEDLOD_HXX
18 #define SGPAGEDLOD_HXX 1
20 #include <simgear/structure/OSGVersion.hxx>
21 #include <osg/PagedLOD>
22 #if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
23 #include <osgDB/Options>
25 #include <osgDB/ReaderWriter>
26 #include <simgear/props/props.hxx>
36 class SGPagedLOD : public osg::PagedLOD
41 SGPagedLOD(const SGPagedLOD&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
43 META_Node(simgear, SGPagedLOD);
45 // virtual void traverse(osg::NodeVisitor& nv);
46 virtual void forceLoad(osgDB::DatabasePager* dbp);
48 // reimplemented to notify the loading through ModelData
49 bool addChild(osg::Node *child);
51 void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) {
52 _readerWriterOptions = options;
53 options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
54 #if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
55 setDatabaseOptions(options);
59 osgDB::ReaderWriter::Options* getReaderWriterOptions() {
60 return _readerWriterOptions.get();
64 virtual ~SGPagedLOD();
65 osg::ref_ptr<osgDB::ReaderWriter::Options> _readerWriterOptions;