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.
18 # include <simgear_config.h>
21 #include <osgDB/ReadFile>
23 #include <simgear/debug/logstream.hxx>
24 #include <simgear/structure/OSGVersion.hxx>
26 #include "modellib.hxx"
27 #include "SGReaderWriterXMLOptions.hxx"
28 #include "SGPagedLOD.hxx"
30 #include <simgear/math/SGMath.hxx>
33 using namespace simgear;
35 SGPagedLOD::SGPagedLOD()
40 SGPagedLOD::~SGPagedLOD()
42 //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::~SGPagedLOD(" << getFileName(0) << ")");
45 SGPagedLOD::SGPagedLOD(const SGPagedLOD& plod,const CopyOp& copyop)
46 : osg::PagedLOD(plod, copyop),
47 _readerWriterOptions(plod._readerWriterOptions)
51 bool SGPagedLOD::addChild(osg::Node *child)
53 if (!PagedLOD::addChild(child))
56 setRadius(getBound().radius());
57 setCenter(getBound().center());
61 void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp)
63 //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
64 //getFileName(getNumChildren()) << ")");
65 unsigned childNum = getNumChildren();
66 setTimeStamp(childNum, 0);
68 dbp->requestNodeFile(getFileName(childNum),this,priority,0,
69 getDatabaseRequest(childNum),
70 _readerWriterOptions.get());