1
0
Fork 0

Merge branch 'maint' into next

This commit is contained in:
Tim Moore 2009-05-18 12:23:33 +02:00
commit 70be1629e6
3 changed files with 18 additions and 49 deletions

View file

@ -41,40 +41,34 @@ SceneryPager::~SceneryPager()
} }
void SceneryPager::requestNodeFile(const std::string& fileName, Group* group, void SceneryPager::requestNodeFile(const std::string& fileName, Group* group,
float priority, float priority, const FrameStamp* framestamp,
const FrameStamp* framestamp ref_ptr<Referenced>& databaseRequest,
#ifdef FGOSGPAGER25 #if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
, ref_ptr<Referenced>& databaseRequest const osg::Referenced* options
#else
osgDB::ReaderWriter::Options* options
#endif #endif
) )
{ {
simgear::SGPagedLOD *sgplod = dynamic_cast<simgear::SGPagedLOD*>(group); simgear::SGPagedLOD *sgplod = dynamic_cast<simgear::SGPagedLOD*>(group);
if(sgplod) if(sgplod)
DatabasePager::requestNodeFile(fileName, group, priority, framestamp, DatabasePager::requestNodeFile(fileName, group, priority, framestamp,
#ifdef FGOSGPAGER25
databaseRequest, databaseRequest,
#endif
sgplod->getReaderWriterOptions()); sgplod->getReaderWriterOptions());
else else
DatabasePager::requestNodeFile(fileName, group, priority, framestamp DatabasePager::requestNodeFile(fileName, group, priority, framestamp,
#ifdef FGOSGPAGER25 databaseRequest,
, databaseRequest options);
#endif
);
} }
void SceneryPager::queueRequest(const std::string& fileName, Group* group, void SceneryPager::queueRequest(const std::string& fileName, Group* group,
float priority, FrameStamp* frameStamp, float priority, FrameStamp* frameStamp,
#ifdef FGOSGPAGER25
ref_ptr<Referenced>& databaseRequest, ref_ptr<Referenced>& databaseRequest,
#endif
osgDB::ReaderWriter::Options* options) osgDB::ReaderWriter::Options* options)
{ {
_pagerRequests.push_back(PagerRequest(fileName, group, priority, _pagerRequests.push_back(PagerRequest(fileName, group, priority,
frameStamp, frameStamp,
#ifdef FGOSGPAGER25
databaseRequest, databaseRequest,
#endif
options)); options));
} }
@ -90,15 +84,9 @@ void SceneryPager::signalEndFrame()
bool arePagerRequests = false; bool arePagerRequests = false;
if (!_deleteRequests.empty()) { if (!_deleteRequests.empty()) {
areDeleteRequests = true; areDeleteRequests = true;
#ifdef FGOSGPAGER25
OpenThreads::ScopedLock<OpenThreads::Mutex> OpenThreads::ScopedLock<OpenThreads::Mutex>
lock(_fileRequestQueue->_childrenToDeleteListMutex); lock(_fileRequestQueue->_childrenToDeleteListMutex);
ObjectList& deleteList = _fileRequestQueue->_childrenToDeleteList; ObjectList& deleteList = _fileRequestQueue->_childrenToDeleteList;
#else
OpenThreads::ScopedLock<OpenThreads::Mutex>
lock(_childrenToDeleteListMutex);
ObjectList& deleteList = _childrenToDeleteList;
#endif
deleteList.insert(deleteList.end(), deleteList.insert(deleteList.end(),
_deleteRequests.begin(), _deleteRequests.begin(),
_deleteRequests.end()); _deleteRequests.end());
@ -111,11 +99,7 @@ void SceneryPager::signalEndFrame()
_pagerRequests.clear(); _pagerRequests.clear();
} }
if (areDeleteRequests && !arePagerRequests) { if (areDeleteRequests && !arePagerRequests) {
#ifdef FGOSGPAGER25
_fileRequestQueue->updateBlock(); _fileRequestQueue->updateBlock();
#else
updateDatabasePagerThreadBlock();
#endif
} }
DatabasePager::signalEndFrame(); DatabasePager::signalEndFrame();
} }

View file

@ -19,6 +19,7 @@
// $Id$ // $Id$
#ifndef FLIGHTGEAR_SCENERYPAGERHXX #ifndef FLIGHTGEAR_SCENERYPAGERHXX
#define FLIGHTGEAR_SCENERYPAGERHXX 1
#include <string> #include <string>
#include <vector> #include <vector>
@ -28,11 +29,6 @@
#include <simgear/structure/OSGVersion.hxx> #include <simgear/structure/OSGVersion.hxx>
// Pager request change in OpenSceneGraph 2.5.1
#if SG_OSG_VERSION >= 25001
#define FGOSGPAGER25
#endif
namespace flightgear namespace flightgear
{ {
class SceneryPager : public osgDB::DatabasePager class SceneryPager : public osgDB::DatabasePager
@ -45,17 +41,17 @@ public:
// reimplement to add readerWriterOptions from SGPagedLOD // reimplement to add readerWriterOptions from SGPagedLOD
virtual void requestNodeFile(const std::string& fileName, osg::Group* group, virtual void requestNodeFile(const std::string& fileName, osg::Group* group,
float priority, float priority,
const osg::FrameStamp* framestamp const osg::FrameStamp* framestamp,
#ifdef FGOSGPAGER25 osg::ref_ptr<osg::Referenced>& databaseRequest,
, osg::ref_ptr<osg::Referenced>& #if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
databaseRequest const osg::Referenced* options
#else
osgDB::ReaderWriter::Options* options
#endif #endif
); );
void queueRequest(const std::string& fileName, osg::Group* node, void queueRequest(const std::string& fileName, osg::Group* node,
float priority, osg::FrameStamp* frameStamp, float priority, osg::FrameStamp* frameStamp,
#ifdef FGOSGPAGER25
osg::ref_ptr<osg::Referenced>& databaseRequest, osg::ref_ptr<osg::Referenced>& databaseRequest,
#endif
osgDB::ReaderWriter::Options* options); osgDB::ReaderWriter::Options* options);
// This is passed a ref_ptr so that it can "take ownership" of the // This is passed a ref_ptr so that it can "take ownership" of the
// node to delete and decrement its refcount while holding the // node to delete and decrement its refcount while holding the
@ -74,17 +70,11 @@ protected:
PagerRequest(const std::string& fileName, osg::Group* group, PagerRequest(const std::string& fileName, osg::Group* group,
float priority, osg::FrameStamp* frameStamp, float priority, osg::FrameStamp* frameStamp,
#ifdef FGOSGPAGER25
osg::ref_ptr<Referenced>& databaseRequest, osg::ref_ptr<Referenced>& databaseRequest,
#endif
osgDB::ReaderWriter::Options* options): osgDB::ReaderWriter::Options* options):
_fileName(fileName), _group(group), _priority(priority), _fileName(fileName), _group(group), _priority(priority),
_frameStamp(frameStamp), _options(options), _frameStamp(frameStamp), _options(options),
#ifdef FGOSGPAGER25
_databaseRequest(&databaseRequest) _databaseRequest(&databaseRequest)
#else
_databaseRequest(0)
#endif
{} {}
void doRequest(SceneryPager* pager) void doRequest(SceneryPager* pager)
@ -92,9 +82,7 @@ protected:
if (_group->getNumChildren() == 0) if (_group->getNumChildren() == 0)
pager->requestNodeFile(_fileName, _group.get(), _priority, pager->requestNodeFile(_fileName, _group.get(), _priority,
_frameStamp.get(), _frameStamp.get(),
#ifdef FGOSGPAGER25
*_databaseRequest, *_databaseRequest,
#endif
_options.get()); _options.get());
} }
@ -112,5 +100,4 @@ protected:
virtual ~SceneryPager(); virtual ~SceneryPager();
}; };
} }
#define FLIGHTGEAR_SCENERYPAGERHXX 1
#endif #endif

View file

@ -279,9 +279,7 @@ public:
entry->getNode(), entry->getNode(),
entry->get_inner_ring() ? 10.0f : 1.0f, entry->get_inner_ring() ? 10.0f : 1.0f,
_framestamp, _framestamp,
#ifdef FGOSGPAGER25
entry->getDatabaseRequest(), entry->getDatabaseRequest(),
#endif
_options); _options);
} }
} }