FlightGear next
SceneryPager.hxx
Go to the documentation of this file.
1// SceneryPager.hxx -- Interface to OSG database pager
2//
3// Copyright (C) 2007 Tim Moore timoore@redhat.com
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License as
7// published by the Free Software Foundation; either version 2 of the
8// License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18//
19// $Id$
20
21#ifndef FLIGHTGEAR_SCENERYPAGERHXX
22#define FLIGHTGEAR_SCENERYPAGERHXX 1
23#include <string>
24#include <vector>
25
26#include <osg/FrameStamp>
27#include <osg/Group>
28#include <osgDB/DatabasePager>
29
30namespace flightgear
31{
32class SceneryPager : public osgDB::DatabasePager
33{
34public:
36 SceneryPager(const SceneryPager& rhs);
37 // Unhide DatabasePager::requestNodeFile
38 using osgDB::DatabasePager::requestNodeFile;
39 void queueRequest(const std::string& fileName, osg::Group* node,
40 float priority, osg::FrameStamp* frameStamp,
41 osg::ref_ptr<osg::Referenced>& databaseRequest,
42 osgDB::ReaderWriter::Options* options);
43 // This is passed a ref_ptr so that it can "take ownership" of the
44 // node to delete and decrement its refcount while holding the
45 // lock on the delete list.
46 void queueDeleteRequest(osg::ref_ptr<osg::Object>& objptr);
47 virtual void signalEndFrame();
48
49 void clearRequests();
50protected:
51 // Queue up file requests until the end of the frame
53 {
59
60 PagerRequest(const std::string& fileName, osg::Group* group,
61 float priority, osg::FrameStamp* frameStamp,
62 osg::ref_ptr<Referenced>& databaseRequest,
63 osgDB::ReaderWriter::Options* options):
64 _fileName(fileName), _group(group), _priority(priority),
65 _frameStamp(frameStamp), _options(options),
66 _databaseRequest(&databaseRequest)
67 {}
68
70 std::string _fileName;
71 osg::ref_ptr<osg::Group> _group;
72 float _priority;
73 osg::ref_ptr<osg::FrameStamp> _frameStamp;
74 osg::ref_ptr<osgDB::ReaderWriter::Options> _options;
75 osg::ref_ptr<osg::Referenced>* _databaseRequest;
76 };
77 typedef std::vector<PagerRequest> PagerRequestList;
79 typedef std::vector<osg::ref_ptr<osg::Object> > DeleteRequestList;
81 virtual ~SceneryPager();
82};
83}
84#endif
bool options(int, char **)
Definition JSBSim.cpp:568
PagerRequestList _pagerRequests
virtual void signalEndFrame()
DeleteRequestList _deleteRequests
std::vector< PagerRequest > PagerRequestList
void queueDeleteRequest(osg::ref_ptr< osg::Object > &objptr)
void queueRequest(const std::string &fileName, osg::Group *node, float priority, osg::FrameStamp *frameStamp, osg::ref_ptr< osg::Referenced > &databaseRequest, osgDB::ReaderWriter::Options *options)
std::vector< osg::ref_ptr< osg::Object > > DeleteRequestList
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53
static osg::ref_ptr< SceneryPager > pager
Definition scenery.cxx:558
PagerRequest(const std::string &fileName, osg::Group *group, float priority, osg::FrameStamp *frameStamp, osg::ref_ptr< Referenced > &databaseRequest, osgDB::ReaderWriter::Options *options)
osg::ref_ptr< osg::Referenced > * _databaseRequest
osg::ref_ptr< osgDB::ReaderWriter::Options > _options
osg::ref_ptr< osg::FrameStamp > _frameStamp
void doRequest(SceneryPager *pager)
osg::ref_ptr< osg::Group > _group
PagerRequest(const PagerRequest &rhs)