Improvements to the DatabasePager

This commit is contained in:
Robert Osfield
2003-10-12 12:13:58 +00:00
parent fad832425f
commit 42eb39ef37
3 changed files with 177 additions and 68 deletions

View File

@@ -22,6 +22,8 @@
#include <OpenThreads/Thread>
#include <OpenThreads/Mutex>
#include <Producer/Block>
#include <osgDB/Export>
#include <map>
@@ -43,6 +45,15 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
/** run does the database paging.*/
virtual void run();
/** Signal the database thread that the update, cull and draw has begun for a new frame.
* Note, this is called by the application so that the database pager can go to sleep while the CPU is busy on the main rendering threads. */
void signalBeginFrame(const osg::FrameStamp* framestamp);
/** Signal the database thread that the update, cull and draw dispatch has completed.
* Note, this is called by the application so that the database pager can go to wake back up now the main rendering threads are iddle waiting for the next frame.*/
void signalEndFrame();
/** Add the loaded data to the scene graph.*/
void addLoadedDataToSceneGraph(double timeStamp);
@@ -121,8 +132,10 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
{}
std::string _fileName;
int _frameNumberFirstRequest;
double _timestampFirstRequest;
float _priorityFirstRequest;
int _frameNumberLastRequest;
double _timestampLastRequest;
float _priorityLastRequest;
unsigned int _numOfRequests;
@@ -138,25 +151,29 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual ~DatabasePager();
DatabaseRequestList _fileRequestList;
OpenThreads::Mutex _fileRequestListMutex;
DatabaseRequestList _dataToCompileList;
OpenThreads::Mutex _dataToCompileListMutex;
bool _deleteRemovedSubgraphsInDatabaseThread;
osg::NodeList _childrenToDeleteList;
OpenThreads::Mutex _childrenToDeleteListMutex;
osg::ref_ptr<Producer::Block> _frameBlock;
int _frameNumber;
DatabaseRequestList _dataToMergeList;
OpenThreads::Mutex _dataToMergeListMutex;
DatabaseRequestList _fileRequestList;
OpenThreads::Mutex _fileRequestListMutex;
osg::ref_ptr<Producer::Block> _fileRequestListEmptyBlock;
DatabaseRequestList _dataToCompileList;
OpenThreads::Mutex _dataToCompileListMutex;
PagedLODList _pagedLODList;
double _expiryDelay;
bool _deleteRemovedSubgraphsInDatabaseThread;
osg::NodeList _childrenToDeleteList;
OpenThreads::Mutex _childrenToDeleteListMutex;
ActiveGraphicsContexts _activeGraphicsContexts;
DatabaseRequestList _dataToMergeList;
OpenThreads::Mutex _dataToMergeListMutex;
PagedLODList _pagedLODList;
double _expiryDelay;
ActiveGraphicsContexts _activeGraphicsContexts;
};