Simplified the API for using the DatabasePager, by providing a single
DatabasePager::updateSceneGraph(..) method, and added a ref_ptr<> into osDB::Registry for managing a single DatabasePager in a centralised way.
This commit is contained in:
@@ -94,10 +94,6 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
void signalEndFrame();
|
||||
|
||||
|
||||
/** Add the loaded data to the scene graph.*/
|
||||
void addLoadedDataToSceneGraph(double timeStamp);
|
||||
|
||||
|
||||
/** 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. */
|
||||
@@ -122,17 +118,27 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
* children which havn't been visited since specified expiryTime.
|
||||
* note, should be only be called from the update thread. */
|
||||
void removeExpiredSubgraphs(double currentFrameTime);
|
||||
|
||||
/** Add the loaded data to the scene graph.*/
|
||||
void addLoadedDataToSceneGraph(double currentFrameTime);
|
||||
|
||||
/** Merge the changes to the scene graph by calling calling removeExpiredSubgraphs then addLoadedDataToSceneGraph*/
|
||||
void updateSceneGraph(double currentFrameTime)
|
||||
{
|
||||
removeExpiredSubgraphs(currentFrameTime);
|
||||
addLoadedDataToSceneGraph(currentFrameTime);
|
||||
}
|
||||
|
||||
|
||||
/** Turn the compilation of rendering objects for specfied graphics context on (true) or off(false).*/
|
||||
void setCompileRenderingObjectsForContexID(unsigned int contextID, bool on);
|
||||
void setCompileGLObjectsForContexID(unsigned int contextID, bool on);
|
||||
|
||||
/** Get whether the compilation of rendering objects for specfied graphics context on (true) or off(false).*/
|
||||
bool getCompileRenderingObjectsForContexID(unsigned int contextID);
|
||||
bool getCompileGLObjectsForContexID(unsigned int contextID);
|
||||
|
||||
/** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph.
|
||||
* note, should only be called from the draw thread.*/
|
||||
void compileRenderingObjects(osg::State& state,double& availableTime);
|
||||
void compileGLObjects(osg::State& state,double& availableTime);
|
||||
|
||||
/** Helper class used internally to force the release of texture objects
|
||||
* and displace lists.*/
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <osgDB/DynamicLibrary>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/DotOsgWrapper>
|
||||
#include <osgDB/DatabasePager>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -209,6 +210,16 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
DynamicLibrary* getLibrary(const std::string& fileName);
|
||||
|
||||
typedef std::vector< osg::ref_ptr<ReaderWriter> > ReaderWriterList;
|
||||
|
||||
|
||||
/** Set the DatabasePager.*/
|
||||
void setDatabasePager(DatabasePager* databasePager) { _databasePager = databasePager; }
|
||||
|
||||
/** Get the DatabasePager, creating one if one is not already created.*/
|
||||
DatabasePager* getOrCreateDatabasePager();
|
||||
|
||||
/** Get the DatabasePager. Return 0 if no DatabasePager has been assigned.*/
|
||||
DatabasePager* getDatabasePager() { return _databasePager.get(); }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -264,6 +275,8 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
bool _useObjectCacheHint;
|
||||
ObjectCache _objectCache;
|
||||
|
||||
osg::ref_ptr<DatabasePager> _databasePager;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user