Introduced new method of management the number of PagedLOD active, by using

a capping the number of PagedLOD to a sepcified maximum, with pruning of inactive
PagedLOD when the total number of inactive and active PagedLOD goes above the maximum.

To enable the mode set the env var OSG_MAX_PAGEDLOD to a value something like 1000.
This commit is contained in:
Robert Osfield
2008-10-23 16:33:14 +00:00
parent f4f6aa288d
commit c1fd14fb2c
3 changed files with 354 additions and 26 deletions

View File

@@ -148,7 +148,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
/** 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 registerPagedLODs(osg::Node* subgraph);
virtual void registerPagedLODs(osg::Node* subgraph, int frameNumber = 0);
/** Set whether the database pager should pre compile OpenGL objects before allowing
* them to be merged into the scene graph.
@@ -272,7 +272,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
/** Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph.
* Note, must only be called from single thread update phase. */
virtual void updateSceneGraph(const osg::FrameStamp &frameStamp)
virtual void updateSceneGraph(const osg::FrameStamp& frameStamp)
{
removeExpiredSubgraphs(frameStamp);
addLoadedDataToSceneGraph(frameStamp);
@@ -514,6 +514,12 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
* note, should be only be called from the update thread. */
virtual void removeExpiredSubgraphs(const osg::FrameStamp &frameStamp);
/** Old expiry delay based removeExpiredSubgraphs. */
virtual void expiry_removeExpiredSubgraphs(const osg::FrameStamp &frameStamp);
/** New capped based removeExpiredSubgraphs. */
virtual void capped_removeExpiredSubgraphs(const osg::FrameStamp &frameStamp);
/** Add the loaded data to the scene graph.*/
void addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp);
@@ -545,8 +551,11 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
osg::ref_ptr<RequestQueue> _dataToMergeList;
PagedLODList _pagedLODList;
PagedLODList _activePagedLODList;
PagedLODList _inactivePagedLODList;
unsigned int _maximumNumberOfPageLOD;
double _expiryDelay;
int _expiryFrames;