]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGPagedLOD.cxx
cleanup
[simgear.git] / simgear / scene / model / SGPagedLOD.cxx
1 // Copyright (C) 2008 Till Busch buti@bux.at
2 //
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.
7 //
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.
12 //
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.
16
17 #include <osgDB/ReadFile>
18
19 #include <simgear/debug/logstream.hxx>
20 #include <simgear/structure/OSGVersion.hxx>
21
22 #include "modellib.hxx"
23 #include "SGReaderWriterXMLOptions.hxx"
24 #include "SGPagedLOD.hxx"
25
26 using namespace osg;
27 using namespace simgear;
28
29 SGPagedLOD::SGPagedLOD()
30         : PagedLOD()
31 {
32 }
33
34 SGPagedLOD::~SGPagedLOD()
35 {
36     //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::~SGPagedLOD(" << getFileName(0) << ")");
37 }
38
39 SGPagedLOD::SGPagedLOD(const SGPagedLOD& plod,const CopyOp& copyop)
40         : osg::PagedLOD(plod, copyop),
41         _readerWriterOptions(plod._readerWriterOptions)
42 {
43 }
44
45 bool SGPagedLOD::addChild(osg::Node *child)
46 {
47     if (!PagedLOD::addChild(child))
48         return false;
49
50     setRadius(getBound().radius());
51     setCenter(getBound().center());
52     return true;
53 }
54
55 void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp)
56 {
57     //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
58     //getFileName(getNumChildren()) << ")");
59     unsigned childNum = getNumChildren();
60     setTimeStamp(childNum, 0);
61     double priority=1.0;
62     dbp->requestNodeFile(getFileName(childNum),this,priority,0,
63                          getDatabaseRequest(childNum),
64                          _readerWriterOptions.get());
65 }
66