OpenSceneGraph  3.5.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osgUtil::IncrementalCompileOperation Class Reference
Inheritance diagram for osgUtil::IncrementalCompileOperation:
Inheritance graph
[legend]

Classes

struct  CompileCompletedCallback
 
struct  CompileDrawableOp
 
struct  CompileInfo
 
class  CompileList
 
struct  CompileOp
 
struct  CompileProgramOp
 
class  CompileSet
 
struct  CompileTextureOp
 

Public Types

typedef std::vector< osg::GraphicsContext * > Contexts
 
typedef std::set< osg::GraphicsContext * > ContextSet
 
typedef std::list< osg::ref_ptr< CompileSet > > CompileSets
 

Public Member Functions

 IncrementalCompileOperation ()
 
bool isActive () const
 Return true if the IncrementCompileOperation is active. More...
 
bool requiresCompile (StateToCompile &stateToCompile)
 
void setTargetFrameRate (double tfr)
 Set the target frame rate that the IncrementalCompileOperation should assume. More...
 
double getTargetFrameRate () const
 Get the target frame rate that the IncrementalCompileOperation should assume. More...
 
void setMinimumTimeAvailableForGLCompileAndDeletePerFrame (double ta)
 Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame. More...
 
double getMinimumTimeAvailableForGLCompileAndDeletePerFrame () const
 Get the minimum amount of time that should be made available for compiling and delete OpenGL objects per frame. More...
 
void setMaximumNumOfObjectsToCompilePerFrame (unsigned int num)
 Set the maximum number of OpenGL objects that the page should attempt to compile per frame. More...
 
unsigned int getMaximumNumOfObjectsToCompilePerFrame () const
 Get the maximum number of OpenGL objects that the page should attempt to compile per frame. More...
 
void setFlushTimeRatio (double ratio)
 FlushTimeRatio governs how much of the spare time in each frame is used for flushing deleted OpenGL objects. More...
 
double getFlushTimeRatio () const
 
void setConservativeTimeRatio (double ratio)
 ConservativeTimeRatio governs how much of the measured spare time in each frame is used for flushing deleted and compile new OpenGL objects. More...
 
double getConservativeTimeRatio () const
 
void assignForceTextureDownloadGeometry ()
 Assign a geometry and associated StateSet than is applied after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card. More...
 
void setForceTextureDownloadGeometry (osg::Geometry *geom)
 Set the osg::Geometry to apply after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card. More...
 
osg::GeometrygetForceTextureDownloadGeometry ()
 
const osg::GeometrygetForceTextureDownloadGeometry () const
 
void assignContexts (Contexts &contexts)
 
void removeContexts (Contexts &contexts)
 
void addGraphicsContext (osg::GraphicsContext *gc)
 
void removeGraphicsContext (osg::GraphicsContext *gc)
 
ContextSetgetContextSet ()
 
const ContextSetgetContextSet () const
 
void mergeCompiledSubgraphs (const osg::FrameStamp *frameStamp)
 Merge subgraphs that have been compiled. More...
 
void setCurrentFrameNumber (unsigned int fn)
 Set the current frame number that the IncrementalCompileOperation should use as a reference value for calculations based on current frame number. More...
 
unsigned int getCurrentFrameNumber () const
 
void compileAllForNextFrame (unsigned int numFramesToDoCompileAll=1)
 tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, for specified number of frames. More...
 
void setCompileAllTillFrameNumber (unsigned int fn)
 tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, till specified frame number. More...
 
unsigned int getCompileAllTillFrameNumber () const
 
virtual void operator() (osg::GraphicsContext *context)
 
void add (osg::Node *subgraphToCompile)
 Add a subgraph to be compiled. More...
 
void add (osg::Group *attachmentPoint, osg::Node *subgraphToCompile)
 Add a subgraph to be compiled and add automatically to attachPoint on call to mergeCompiledSubgraphs. More...
 
void add (CompileSet *compileSet, bool callBuildCompileMap=true)
 Add a CompileSet to be compiled. More...
 
void remove (CompileSet *compileSet)
 Remove CompileSet from list. More...
 
OpenThreads::Mutex * getToCompiledMutex ()
 
CompileSetsgetToCompile ()
 
OpenThreads::Mutex * getCompiledMutex ()
 
CompileSetsgetCompiled ()
 
void setMarkerObject (osg::Object *mo)
 
osg::ObjectgetMarkerObject ()
 
const osg::ObjectgetMarkerObject () const
 
- Public Member Functions inherited from osg::GraphicsOperation
 GraphicsOperation (const std::string &name, bool keep)
 
virtual void operator() (Object *object)
 Override the standard Operation operator and dynamic cast object to a GraphicsContext, on success call operation()(GraphicsContext*). More...
 
- Public Member Functions inherited from osg::Operation
 Operation (const std::string &name, bool keep)
 
void setName (const std::string &name)
 Set the human readable name of the operation. More...
 
const std::string & getName () const
 Get the human readable name of the operation. More...
 
void setKeep (bool keep)
 Set whether the operation should be kept once its been applied. More...
 
bool getKeep () const
 Get whether the operation should be kept once its been applied. More...
 
virtual void release ()
 if this operation is a barrier then release it. More...
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 Set whether to use a mutex to ensure ref() and unref() are thread safe. More...
 
bool getThreadSafeRefUnref () const
 Get whether a mutex is used to ensure ref() and unref() are thread safe. More...
 
OpenThreads::Mutex * getRefMutex () const
 Get the mutex used to ensure thread safety of ref()/unref(). More...
 
int ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int unref_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int referenceCount () const
 Return the number of pointers currently referencing this object. More...
 
ObserverSetgetObserverSet () const
 Get the ObserverSet if one is attached, otherwise return NULL. More...
 
ObserverSetgetOrCreateObserverSet () const
 Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. More...
 
void addObserver (Observer *observer) const
 Add a Observer that is observing this object, notify the Observer when this object gets deleted. More...
 
void removeObserver (Observer *observer) const
 Remove Observer that is observing this object. More...
 

Protected Member Functions

virtual ~IncrementalCompileOperation ()
 
void compileSets (CompileSets &toCompile, CompileInfo &compileInfo)
 
- Protected Member Functions inherited from osg::Operation
 Operation ()
 
 Operation (const Operation &op)
 
virtual ~Operation ()
 
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
 
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

double _targetFrameRate
 
double _minimumTimeAvailableForGLCompileAndDeletePerFrame
 
unsigned int _maximumNumOfObjectsToCompilePerFrame
 
double _flushTimeRatio
 
double _conservativeTimeRatio
 
unsigned int _currentFrameNumber
 
unsigned int _compileAllTillFrameNumber
 
osg::ref_ptr< osg::Geometry_forceTextureDownloadGeometry
 
OpenThreads::Mutex _toCompileMutex
 
CompileSets _toCompile
 
OpenThreads::Mutex _compiledMutex
 
CompileSets _compiled
 
ContextSet _contexts
 
osg::ref_ptr< osg::Object_markerObject
 
- Protected Attributes inherited from osg::Operation
std::string _name
 
bool _keep
 
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
 
OpenThreads::Atomic _refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * getGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all osg::Referenced. More...
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 Set whether reference counting should use a mutex for thread safe reference counting. More...
 
static bool getThreadSafeReferenceCounting ()
 Get whether reference counting is active. More...
 
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated. More...
 
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

osgUtil::IncrementalCompileOperation::IncrementalCompileOperation ( )
virtual osgUtil::IncrementalCompileOperation::~IncrementalCompileOperation ( )
protectedvirtual

Member Function Documentation

void osgUtil::IncrementalCompileOperation::add ( osg::Node subgraphToCompile)

Add a subgraph to be compiled.

void osgUtil::IncrementalCompileOperation::add ( osg::Group attachmentPoint,
osg::Node subgraphToCompile 
)

Add a subgraph to be compiled and add automatically to attachPoint on call to mergeCompiledSubgraphs.

void osgUtil::IncrementalCompileOperation::add ( CompileSet compileSet,
bool  callBuildCompileMap = true 
)

Add a CompileSet to be compiled.

void osgUtil::IncrementalCompileOperation::addGraphicsContext ( osg::GraphicsContext gc)
void osgUtil::IncrementalCompileOperation::assignContexts ( Contexts contexts)
void osgUtil::IncrementalCompileOperation::assignForceTextureDownloadGeometry ( )

Assign a geometry and associated StateSet than is applied after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card.

void osgUtil::IncrementalCompileOperation::compileAllForNextFrame ( unsigned int  numFramesToDoCompileAll = 1)

tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, for specified number of frames.

void osgUtil::IncrementalCompileOperation::compileSets ( CompileSets toCompile,
CompileInfo compileInfo 
)
protected
unsigned int osgUtil::IncrementalCompileOperation::getCompileAllTillFrameNumber ( ) const
inline
CompileSets& osgUtil::IncrementalCompileOperation::getCompiled ( )
inline
OpenThreads::Mutex* osgUtil::IncrementalCompileOperation::getCompiledMutex ( )
inline
double osgUtil::IncrementalCompileOperation::getConservativeTimeRatio ( ) const
inline
ContextSet& osgUtil::IncrementalCompileOperation::getContextSet ( )
inline
const ContextSet& osgUtil::IncrementalCompileOperation::getContextSet ( ) const
inline
unsigned int osgUtil::IncrementalCompileOperation::getCurrentFrameNumber ( ) const
inline
double osgUtil::IncrementalCompileOperation::getFlushTimeRatio ( ) const
inline
osg::Geometry* osgUtil::IncrementalCompileOperation::getForceTextureDownloadGeometry ( )
inline
const osg::Geometry* osgUtil::IncrementalCompileOperation::getForceTextureDownloadGeometry ( ) const
inline
osg::Object* osgUtil::IncrementalCompileOperation::getMarkerObject ( )
inline
const osg::Object* osgUtil::IncrementalCompileOperation::getMarkerObject ( ) const
inline
unsigned int osgUtil::IncrementalCompileOperation::getMaximumNumOfObjectsToCompilePerFrame ( ) const
inline

Get the maximum number of OpenGL objects that the page should attempt to compile per frame.

double osgUtil::IncrementalCompileOperation::getMinimumTimeAvailableForGLCompileAndDeletePerFrame ( ) const
inline

Get the minimum amount of time that should be made available for compiling and delete OpenGL objects per frame.

For usage see notes in setTargetFrameRate.

double osgUtil::IncrementalCompileOperation::getTargetFrameRate ( ) const
inline

Get the target frame rate that the IncrementalCompileOperation should assume.

CompileSets& osgUtil::IncrementalCompileOperation::getToCompile ( )
inline
OpenThreads::Mutex* osgUtil::IncrementalCompileOperation::getToCompiledMutex ( )
inline
bool osgUtil::IncrementalCompileOperation::isActive ( ) const
inline

Return true if the IncrementCompileOperation is active.

void osgUtil::IncrementalCompileOperation::mergeCompiledSubgraphs ( const osg::FrameStamp frameStamp)

Merge subgraphs that have been compiled.

virtual void osgUtil::IncrementalCompileOperation::operator() ( osg::GraphicsContext context)
virtual
void osgUtil::IncrementalCompileOperation::remove ( CompileSet compileSet)

Remove CompileSet from list.

void osgUtil::IncrementalCompileOperation::removeContexts ( Contexts contexts)
void osgUtil::IncrementalCompileOperation::removeGraphicsContext ( osg::GraphicsContext gc)
bool osgUtil::IncrementalCompileOperation::requiresCompile ( StateToCompile stateToCompile)
void osgUtil::IncrementalCompileOperation::setCompileAllTillFrameNumber ( unsigned int  fn)
inline

tell the IncrementalCompileOperation to compile all pending objects during next draw traversal, till specified frame number.

void osgUtil::IncrementalCompileOperation::setConservativeTimeRatio ( double  ratio)
inline

ConservativeTimeRatio governs how much of the measured spare time in each frame is used for flushing deleted and compile new OpenGL objects.

Default value is 0.5, valid range is 0.1 to 1.0. A ratio near 1.0 will lead to paged databases being compiled and merged quicker but increase the chances of frame drop. A ratio near 0.1 will lead to paged databases being compiled and merged closer but reduse the chances of frame drop.

void osgUtil::IncrementalCompileOperation::setCurrentFrameNumber ( unsigned int  fn)
inline

Set the current frame number that the IncrementalCompileOperation should use as a reference value for calculations based on current frame number.

Note, this value is set by the mergeCompiledSubgraphs(..) method so one won't normally need to call set the CurrentFrameNumber manually.

void osgUtil::IncrementalCompileOperation::setFlushTimeRatio ( double  ratio)
inline

FlushTimeRatio governs how much of the spare time in each frame is used for flushing deleted OpenGL objects.

Default value is 0.5, valid range is 0.1 to 0.9.

void osgUtil::IncrementalCompileOperation::setForceTextureDownloadGeometry ( osg::Geometry geom)
inline

Set the osg::Geometry to apply after each texture compile to atttempt to force the OpenGL drive to download the texture object to OpenGL graphics card.

void osgUtil::IncrementalCompileOperation::setMarkerObject ( osg::Object mo)
inline
void osgUtil::IncrementalCompileOperation::setMaximumNumOfObjectsToCompilePerFrame ( unsigned int  num)
inline

Set the maximum number of OpenGL objects that the page should attempt to compile per frame.

Note, Lower values reduces chances of a frame drop but lower the rate that database will be paged in at. Default value is 8.

void osgUtil::IncrementalCompileOperation::setMinimumTimeAvailableForGLCompileAndDeletePerFrame ( double  ta)
inline

Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame.

Default value is 0.001 (1 millisecond). For usage see notes in setTargetFrameRate.

void osgUtil::IncrementalCompileOperation::setTargetFrameRate ( double  tfr)
inline

Set the target frame rate that the IncrementalCompileOperation should assume.

Typically one would set this to the value refresh rate of your display system i.e. 60Hz. Default value is 100. Usage notes. The TargetFrameRate and the MinimumTimeAvailableForGLCompileAndDeletePerFrame parameters are not directly used by IncrementalCompileOperation, but are should be used as a guide for how long to set aside per frame for compiling and deleting OpenGL objects. The longer amount of time to set aside the faster databases will be paged in but with increased chance of frame drops, the lower the amount of time the set aside the slower databases will paged it but with better chance of avoid any frame drops. The default values are chosen to achieve the later when running on a modern mid to high end PC. The way to compute the amount of available time use a scheme such as : availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame).

Member Data Documentation

unsigned int osgUtil::IncrementalCompileOperation::_compileAllTillFrameNumber
protected
CompileSets osgUtil::IncrementalCompileOperation::_compiled
protected
OpenThreads::Mutex osgUtil::IncrementalCompileOperation::_compiledMutex
protected
double osgUtil::IncrementalCompileOperation::_conservativeTimeRatio
protected
ContextSet osgUtil::IncrementalCompileOperation::_contexts
protected
unsigned int osgUtil::IncrementalCompileOperation::_currentFrameNumber
protected
double osgUtil::IncrementalCompileOperation::_flushTimeRatio
protected
osg::ref_ptr<osg::Geometry> osgUtil::IncrementalCompileOperation::_forceTextureDownloadGeometry
protected
osg::ref_ptr<osg::Object> osgUtil::IncrementalCompileOperation::_markerObject
protected
unsigned int osgUtil::IncrementalCompileOperation::_maximumNumOfObjectsToCompilePerFrame
protected
double osgUtil::IncrementalCompileOperation::_minimumTimeAvailableForGLCompileAndDeletePerFrame
protected
double osgUtil::IncrementalCompileOperation::_targetFrameRate
protected
CompileSets osgUtil::IncrementalCompileOperation::_toCompile
protected
OpenThreads::Mutex osgUtil::IncrementalCompileOperation::_toCompileMutex
protected

The documentation for this class was generated from the following file:

osg logo
Generated at Wed Nov 11 2015 22:15:15 for the OpenSceneGraph by doxygen 1.8.10.