OpenSceneGraph
3.0.1
|
Database paging class which manages the loading of files in a background thread, and synchronizing of loaded models with the main scene graph. More...
Classes | |
struct | DatabaseRequest |
class | DatabaseThread |
struct | PagedLODList |
struct | ReadQueue |
struct | RequestQueue |
Public Types | |
enum | DrawablePolicy { DO_NOT_MODIFY_DRAWABLE_SETTINGS, USE_DISPLAY_LISTS, USE_VERTEX_BUFFER_OBJECTS, USE_VERTEX_ARRAYS } |
typedef OpenThreads::Thread::ThreadPriority | ThreadPriority |
typedef std::set< osg::ref_ptr < osg::StateSet > > | StateSetList |
typedef std::vector < osg::ref_ptr< osg::Drawable > > | DrawableList |
typedef std::list < osg::ref_ptr< osg::Object > > | ObjectList |
Public Member Functions | |
DatabasePager () | |
DatabasePager (const DatabasePager &rhs) | |
virtual const char * | className () const |
virtual DatabasePager * | clone () const |
Create a shallow copy on the DatabasePager. | |
virtual void | requestNodeFile (const std::string &fileName, osg::NodePath &nodePath, float priority, const osg::FrameStamp *framestamp, osg::ref_ptr< osg::Referenced > &databaseRequest, const osg::Referenced *options) |
Add a request to load a node file to end the the database request list. | |
int | setSchedulePriority (OpenThreads::Thread::ThreadPriority priority) |
Set the priority of the database pager thread(s). | |
virtual int | cancel () |
Cancel the database pager thread(s). | |
virtual bool | isRunning () const |
virtual void | clear () |
Clear all internally cached structures. | |
void | setUpThreads (unsigned int totalNumThreads=2, unsigned int numHttpThreads=1) |
unsigned int | addDatabaseThread (DatabaseThread::Mode mode, const std::string &name) |
DatabaseThread * | getDatabaseThread (unsigned int i) |
const DatabaseThread * | getDatabaseThread (unsigned int i) const |
unsigned int | getNumDatabaseThreads () const |
void | setDatabasePagerThreadPause (bool pause) |
Set whether the database pager thread should be paused or not. | |
bool | getDatabasePagerThreadPause () const |
Get whether the database pager thread should is paused or not. | |
void | setAcceptNewDatabaseRequests (bool acceptNewRequests) |
Set whether new database request calls are accepted or ignored. | |
bool | getAcceptNewDatabaseRequests () const |
Get whether new database request calls are accepted or ignored. | |
int | getNumFramesActive () const |
Get the number of frames that are currently active. | |
virtual void | signalBeginFrame (const osg::FrameStamp *framestamp) |
Signal the database thread that the update, cull and draw has begun for a new frame. | |
virtual void | signalEndFrame () |
Signal the database thread that the update, cull and draw dispatch has completed. | |
virtual void | registerPagedLODs (osg::Node *subgraph, unsigned int frameNumber=0) |
Find all PagedLOD nodes in a subgraph and register them with the DatabasePager so it can keep track of expired nodes. | |
void | setIncrementalCompileOperation (osgUtil::IncrementalCompileOperation *ico) |
Set the incremental compile operation. | |
osgUtil::IncrementalCompileOperation * | getIncrementalCompileOperation () |
Get the incremental compile operation. | |
void | setDoPreCompile (bool flag) |
Set whether the database pager should pre compile OpenGL objects before allowing them to be merged into the scene graph. | |
bool | getDoPreCompile () const |
Get whether the database pager should pre compile OpenGL objects before allowing them to be merged into the scene graph. | |
void | setTargetMaximumNumberOfPageLOD (unsigned int target) |
Set the target maximum number of PagedLOD to maintain in memory. | |
unsigned int | getTargetMaximumNumberOfPageLOD () const |
Get the target maximum number of PagedLOD to maintain in memory. | |
void | setDeleteRemovedSubgraphsInDatabaseThread (bool flag) |
Set whether the removed subgraphs should be deleted in the database thread or not. | |
bool | getDeleteRemovedSubgraphsInDatabaseThread () const |
Get whether the removed subgraphs should be deleted in the database thread or not. | |
void | setDrawablePolicy (DrawablePolicy policy) |
Set how loaded drawables should be handled w.r.t their display list/vertex buffer object/vertex array settings. | |
DrawablePolicy | getDrawablePolicy () const |
Get how loaded drawables should be handled w.r.t their display list/vertex buffer object/vertex array settings. | |
void | setApplyPBOToImages (bool assignPBOToImages) |
Set whether newly loaded textures should have a PixelBufferObject assigned to them to aid download to the GPU. | |
bool | getApplyPBOToImages () const |
Get whether newly loaded textures should have a PixelBufferObject assigned to them. | |
void | setUnrefImageDataAfterApplyPolicy (bool changeAutoUnRef, bool valueAutoUnRef) |
Set whether newly loaded textures should have their UnrefImageDataAfterApply set to a specified value. | |
void | getUnrefImageDataAfterApplyPolicy (bool &changeAutoUnRef, bool &valueAutoUnRef) const |
Get whether newly loaded textures should have their UnrefImageDataAfterApply set to a specified value. | |
void | setMaxAnisotropyPolicy (bool changeAnisotropy, float valueAnisotropy) |
Set whether newly loaded textures should have their MaxAnisotopy set to a specified value. | |
void | getMaxAnisotropyPolicy (bool &changeAnisotropy, float &valueAnisotropy) const |
Set whether newly loaded textures should have their MaxAnisotopy set to a specified value. | |
bool | requiresUpdateSceneGraph () const |
Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double). | |
virtual void | updateSceneGraph (const osg::FrameStamp &frameStamp) |
Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph. | |
unsigned int | getFileRequestListSize () const |
Report how many items are in the _fileRequestList queue. | |
unsigned int | getDataToCompileListSize () const |
Report how many items are in the _dataToCompileList queue. | |
unsigned int | getDataToMergeListSize () const |
Report how many items are in the _dataToMergeList queue. | |
bool | getRequestsInProgress () const |
Report whether any requests are in the pager. | |
double | getMinimumTimeToMergeTile () const |
Get the minimum time between the first request for a tile to be loaded and the time of its merge into the main scene graph. | |
double | getMaximumTimeToMergeTile () const |
Get the maximum time between the first request for a tile to be loaded and the time of its merge into the main scene graph. | |
double | getAverageTimeToMergeTiles () const |
Get the average time between the first request for a tile to be loaded and the time of its merge into the main scene graph. | |
void | resetStats () |
Reset the Stats variables. | |
Static Public Member Functions | |
static osg::ref_ptr < DatabasePager > & | prototype () |
get the prototype singleton used by DatabasePager::create(). | |
static DatabasePager * | create () |
create a DatabasePager by cloning DatabasePager::prototype(). | |
Protected Types | |
typedef std::vector < osg::ref_ptr< DatabaseThread > > | DatabaseThreadList |
Protected Member Functions | |
virtual | ~DatabasePager () |
void | compileCompleted (DatabaseRequest *databaseRequest) |
virtual void | removeExpiredSubgraphs (const osg::FrameStamp &frameStamp) |
Iterate through the active PagedLOD nodes children removing children which havn't been visited since specified expiryTime. | |
void | addLoadedDataToSceneGraph (const osg::FrameStamp &frameStamp) |
Add the loaded data to the scene graph. | |
Protected Attributes | |
OpenThreads::Mutex | _run_mutex |
OpenThreads::Mutex | _dr_mutex |
bool | _startThreadCalled |
bool | _done |
bool | _acceptNewRequests |
bool | _databasePagerThreadPaused |
DatabaseThreadList | _databaseThreads |
int | _numFramesActive |
OpenThreads::Mutex | _numFramesActiveMutex |
OpenThreads::Atomic | _frameNumber |
osg::ref_ptr< ReadQueue > | _fileRequestQueue |
osg::ref_ptr< ReadQueue > | _httpRequestQueue |
osg::ref_ptr< RequestQueue > | _dataToCompileList |
osg::ref_ptr< RequestQueue > | _dataToMergeList |
DrawablePolicy | _drawablePolicy |
bool | _assignPBOToImages |
bool | _changeAutoUnRef |
bool | _valueAutoUnRef |
bool | _changeAnisotropy |
float | _valueAnisotropy |
bool | _deleteRemovedSubgraphsInDatabaseThread |
osg::ref_ptr< PagedLODList > | _activePagedLODList |
unsigned int | _targetMaximumNumberOfPageLOD |
bool | _doPreCompile |
osg::ref_ptr < osgUtil::IncrementalCompileOperation > | _incrementalCompileOperation |
double | _minimumTimeToMergeTile |
double | _maximumTimeToMergeTile |
double | _totalTimeToMergeTiles |
unsigned int | _numTilesMerges |
Friends | |
class | DatabaseThread |
struct | DatabaseRequest |
class | FindCompileableGLObjectsVisitor |
struct | DatabasePagerCompileCompletedCallback |
class | FindPagedLODsVisitor |
struct | SortFileRequestFunctor |
Database paging class which manages the loading of files in a background thread, and synchronizing of loaded models with the main scene graph.
typedef std::vector< osg::ref_ptr<DatabaseThread> > osgDB::DatabasePager::DatabaseThreadList [protected] |
typedef std::vector< osg::ref_ptr<osg::Drawable> > osgDB::DatabasePager::DrawableList |
typedef std::list< osg::ref_ptr<osg::Object> > osgDB::DatabasePager::ObjectList |
typedef std::set< osg::ref_ptr<osg::StateSet> > osgDB::DatabasePager::StateSetList |
typedef OpenThreads::Thread::ThreadPriority osgDB::DatabasePager::ThreadPriority |
osgDB::DatabasePager::DatabasePager | ( | ) |
osgDB::DatabasePager::DatabasePager | ( | const DatabasePager & | rhs | ) |
virtual osgDB::DatabasePager::~DatabasePager | ( | ) | [protected, virtual] |
unsigned int osgDB::DatabasePager::addDatabaseThread | ( | DatabaseThread::Mode | mode, |
const std::string & | name | ||
) |
void osgDB::DatabasePager::addLoadedDataToSceneGraph | ( | const osg::FrameStamp & | frameStamp | ) | [protected] |
Add the loaded data to the scene graph.
virtual int osgDB::DatabasePager::cancel | ( | ) | [virtual] |
Cancel the database pager thread(s).
virtual const char* osgDB::DatabasePager::className | ( | ) | const [inline, virtual] |
virtual void osgDB::DatabasePager::clear | ( | ) | [virtual] |
Clear all internally cached structures.
virtual DatabasePager* osgDB::DatabasePager::clone | ( | ) | const [inline, virtual] |
Create a shallow copy on the DatabasePager.
void osgDB::DatabasePager::compileCompleted | ( | DatabaseRequest * | databaseRequest | ) | [protected] |
static DatabasePager* osgDB::DatabasePager::create | ( | ) | [static] |
create a DatabasePager by cloning DatabasePager::prototype().
bool osgDB::DatabasePager::getAcceptNewDatabaseRequests | ( | ) | const [inline] |
Get whether new database request calls are accepted or ignored.
bool osgDB::DatabasePager::getApplyPBOToImages | ( | ) | const [inline] |
Get whether newly loaded textures should have a PixelBufferObject assigned to them.
double osgDB::DatabasePager::getAverageTimeToMergeTiles | ( | ) | const [inline] |
Get the average time between the first request for a tile to be loaded and the time of its merge into the main scene graph.
bool osgDB::DatabasePager::getDatabasePagerThreadPause | ( | ) | const [inline] |
Get whether the database pager thread should is paused or not.
DatabaseThread* osgDB::DatabasePager::getDatabaseThread | ( | unsigned int | i | ) | [inline] |
const DatabaseThread* osgDB::DatabasePager::getDatabaseThread | ( | unsigned int | i | ) | const [inline] |
unsigned int osgDB::DatabasePager::getDataToCompileListSize | ( | ) | const [inline] |
Report how many items are in the _dataToCompileList queue.
unsigned int osgDB::DatabasePager::getDataToMergeListSize | ( | ) | const [inline] |
Report how many items are in the _dataToMergeList queue.
bool osgDB::DatabasePager::getDeleteRemovedSubgraphsInDatabaseThread | ( | ) | const [inline] |
Get whether the removed subgraphs should be deleted in the database thread or not.
bool osgDB::DatabasePager::getDoPreCompile | ( | ) | const [inline] |
Get whether the database pager should pre compile OpenGL objects before allowing them to be merged into the scene graph.
DrawablePolicy osgDB::DatabasePager::getDrawablePolicy | ( | ) | const [inline] |
Get how loaded drawables should be handled w.r.t their display list/vertex buffer object/vertex array settings.
unsigned int osgDB::DatabasePager::getFileRequestListSize | ( | ) | const [inline] |
Report how many items are in the _fileRequestList queue.
osgUtil::IncrementalCompileOperation* osgDB::DatabasePager::getIncrementalCompileOperation | ( | ) | [inline] |
Get the incremental compile operation.
void osgDB::DatabasePager::getMaxAnisotropyPolicy | ( | bool & | changeAnisotropy, |
float & | valueAnisotropy | ||
) | const [inline] |
Set whether newly loaded textures should have their MaxAnisotopy set to a specified value.
double osgDB::DatabasePager::getMaximumTimeToMergeTile | ( | ) | const [inline] |
Get the maximum time between the first request for a tile to be loaded and the time of its merge into the main scene graph.
double osgDB::DatabasePager::getMinimumTimeToMergeTile | ( | ) | const [inline] |
Get the minimum time between the first request for a tile to be loaded and the time of its merge into the main scene graph.
unsigned int osgDB::DatabasePager::getNumDatabaseThreads | ( | ) | const [inline] |
int osgDB::DatabasePager::getNumFramesActive | ( | ) | const [inline] |
Get the number of frames that are currently active.
bool osgDB::DatabasePager::getRequestsInProgress | ( | ) | const |
Report whether any requests are in the pager.
unsigned int osgDB::DatabasePager::getTargetMaximumNumberOfPageLOD | ( | ) | const [inline] |
Get the target maximum number of PagedLOD to maintain in memory.
void osgDB::DatabasePager::getUnrefImageDataAfterApplyPolicy | ( | bool & | changeAutoUnRef, |
bool & | valueAutoUnRef | ||
) | const [inline] |
Get whether newly loaded textures should have their UnrefImageDataAfterApply set to a specified value.
virtual bool osgDB::DatabasePager::isRunning | ( | ) | const [virtual] |
static osg::ref_ptr<DatabasePager>& osgDB::DatabasePager::prototype | ( | ) | [static] |
get the prototype singleton used by DatabasePager::create().
virtual void osgDB::DatabasePager::registerPagedLODs | ( | osg::Node * | subgraph, |
unsigned int | frameNumber = 0 |
||
) | [virtual] |
Find all PagedLOD nodes in a subgraph and register them with the DatabasePager so it can keep track of expired nodes.
note, should be only be called from the update thread.
virtual void osgDB::DatabasePager::removeExpiredSubgraphs | ( | const osg::FrameStamp & | frameStamp | ) | [protected, virtual] |
Iterate through the active PagedLOD nodes children removing children which havn't been visited since specified expiryTime.
note, should be only be called from the update thread.
virtual void osgDB::DatabasePager::requestNodeFile | ( | const std::string & | fileName, |
osg::NodePath & | nodePath, | ||
float | priority, | ||
const osg::FrameStamp * | framestamp, | ||
osg::ref_ptr< osg::Referenced > & | databaseRequest, | ||
const osg::Referenced * | options | ||
) | [virtual] |
Add a request to load a node file to end the the database request list.
Implements osg::NodeVisitor::DatabaseRequestHandler.
bool osgDB::DatabasePager::requiresUpdateSceneGraph | ( | ) | const |
Return true if there are pending updates to the scene graph that require a call to updateSceneGraph(double).
void osgDB::DatabasePager::resetStats | ( | ) |
Reset the Stats variables.
void osgDB::DatabasePager::setAcceptNewDatabaseRequests | ( | bool | acceptNewRequests | ) | [inline] |
Set whether new database request calls are accepted or ignored.
void osgDB::DatabasePager::setApplyPBOToImages | ( | bool | assignPBOToImages | ) | [inline] |
Set whether newly loaded textures should have a PixelBufferObject assigned to them to aid download to the GPU.
void osgDB::DatabasePager::setDatabasePagerThreadPause | ( | bool | pause | ) |
Set whether the database pager thread should be paused or not.
void osgDB::DatabasePager::setDeleteRemovedSubgraphsInDatabaseThread | ( | bool | flag | ) | [inline] |
Set whether the removed subgraphs should be deleted in the database thread or not.
void osgDB::DatabasePager::setDoPreCompile | ( | bool | flag | ) | [inline] |
Set whether the database pager should pre compile OpenGL objects before allowing them to be merged into the scene graph.
Pre compilation helps reduce the chances of frame drops, but also slows the speed at which tiles are merged as they have to be compiled first.
void osgDB::DatabasePager::setDrawablePolicy | ( | DrawablePolicy | policy | ) | [inline] |
Set how loaded drawables should be handled w.r.t their display list/vertex buffer object/vertex array settings.
void osgDB::DatabasePager::setIncrementalCompileOperation | ( | osgUtil::IncrementalCompileOperation * | ico | ) |
Set the incremental compile operation.
Used to manage the OpenGL object compilation and merging of subgraphs in a way that avoids overloading the rendering of frame with too many new objects in one frame.
void osgDB::DatabasePager::setMaxAnisotropyPolicy | ( | bool | changeAnisotropy, |
float | valueAnisotropy | ||
) | [inline] |
Set whether newly loaded textures should have their MaxAnisotopy set to a specified value.
int osgDB::DatabasePager::setSchedulePriority | ( | OpenThreads::Thread::ThreadPriority | priority | ) |
Set the priority of the database pager thread(s).
void osgDB::DatabasePager::setTargetMaximumNumberOfPageLOD | ( | unsigned int | target | ) | [inline] |
Set the target maximum number of PagedLOD to maintain in memory.
Note, if more than the target number are required for rendering of a frame then these active PagedLOD are excempt from being expiried. But once the number of active drops back below the target the inactive PagedLOD will be trimmed back to the target number.
void osgDB::DatabasePager::setUnrefImageDataAfterApplyPolicy | ( | bool | changeAutoUnRef, |
bool | valueAutoUnRef | ||
) | [inline] |
Set whether newly loaded textures should have their UnrefImageDataAfterApply set to a specified value.
void osgDB::DatabasePager::setUpThreads | ( | unsigned int | totalNumThreads = 2 , |
unsigned int | numHttpThreads = 1 |
||
) |
virtual void osgDB::DatabasePager::signalBeginFrame | ( | const osg::FrameStamp * | framestamp | ) | [virtual] |
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.
virtual void osgDB::DatabasePager::signalEndFrame | ( | ) | [virtual] |
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.
virtual void osgDB::DatabasePager::updateSceneGraph | ( | const osg::FrameStamp & | frameStamp | ) | [virtual] |
Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph.
Note, must only be called from single thread update phase.
friend struct DatabasePagerCompileCompletedCallback [friend] |
friend struct DatabaseRequest [friend] |
friend class DatabaseThread [friend] |
friend class FindCompileableGLObjectsVisitor [friend] |
friend class FindPagedLODsVisitor [friend] |
friend struct SortFileRequestFunctor [friend] |
bool osgDB::DatabasePager::_acceptNewRequests [protected] |
bool osgDB::DatabasePager::_assignPBOToImages [protected] |
bool osgDB::DatabasePager::_changeAnisotropy [protected] |
bool osgDB::DatabasePager::_changeAutoUnRef [protected] |
bool osgDB::DatabasePager::_databasePagerThreadPaused [protected] |
bool osgDB::DatabasePager::_deleteRemovedSubgraphsInDatabaseThread [protected] |
bool osgDB::DatabasePager::_done [protected] |
bool osgDB::DatabasePager::_doPreCompile [protected] |
OpenThreads::Mutex osgDB::DatabasePager::_dr_mutex [protected] |
DrawablePolicy osgDB::DatabasePager::_drawablePolicy [protected] |
osg::ref_ptr<ReadQueue> osgDB::DatabasePager::_fileRequestQueue [protected] |
OpenThreads::Atomic osgDB::DatabasePager::_frameNumber [protected] |
osg::ref_ptr<ReadQueue> osgDB::DatabasePager::_httpRequestQueue [protected] |
osg::ref_ptr<osgUtil::IncrementalCompileOperation> osgDB::DatabasePager::_incrementalCompileOperation [protected] |
double osgDB::DatabasePager::_maximumTimeToMergeTile [protected] |
double osgDB::DatabasePager::_minimumTimeToMergeTile [protected] |
int osgDB::DatabasePager::_numFramesActive [protected] |
OpenThreads::Mutex osgDB::DatabasePager::_numFramesActiveMutex [mutable, protected] |
unsigned int osgDB::DatabasePager::_numTilesMerges [protected] |
OpenThreads::Mutex osgDB::DatabasePager::_run_mutex [protected] |
bool osgDB::DatabasePager::_startThreadCalled [protected] |
unsigned int osgDB::DatabasePager::_targetMaximumNumberOfPageLOD [protected] |
double osgDB::DatabasePager::_totalTimeToMergeTiles [protected] |
float osgDB::DatabasePager::_valueAnisotropy [protected] |
bool osgDB::DatabasePager::_valueAutoUnRef [protected] |
![]() | Generated at Mon Oct 3 2011 12:39:46 for the OpenSceneGraph by doxygen 1.7.5. |