osgUtil::StateGraph Class Reference

`#include <StateGraph>`

Inheritance diagram for osgUtil::StateGraph:

## Public Types

typedef std::map< const osg::StateSet *, osg::ref_ptr< StateGraph > > | ChildList
typedef std::vector< osg::ref_ptr< RenderLeaf > > | LeafList
Public Types inherited from osg::Object
enum | DataVariance { DYNAMIC , STATIC , UNSPECIFIED }

## Public Member Functions

| StateGraph ()
| StateGraph (StateGraph *parent, const osg::StateSet *stateset)
| ~StateGraph ()
virtual osg::Object * | cloneType () const
virtual StateGraph * | cloneStateGraph () const
virtual osg::Object * | clone (const osg::CopyOp &) const
virtual bool | isSameKindAs (const osg::Object *obj) const
virtual const char * | libraryName () const
virtual const char * | className () const
void | setUserData (osg::Referenced *obj)
osg::Referenced * | getUserData ()
const osg::Referenced * | getUserData () const
void | setStateSet (const osg::StateSet *stateset)
const osg::StateSet * | getStateSet () const
bool | empty () const
bool | leaves_empty () const
float | getAverageDistance () const
float | getMinimumDistance () const
void | sortFrontToBack ()
void | reset ()
void | clean ()
void | prune ()
void | resizeGLObjectBuffers (unsigned int maxSize)
void | releaseGLObjects (osg::State *state=0) const
StateGraph * | find_or_insert (const osg::StateSet *stateset)
void | addLeaf (RenderLeaf *leaf)
Public Member Functions inherited from osg::Object
| Object ()
| Object (bool threadSafeRefUnref)
| Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
std::string | getCompoundClassName () const
virtual Node * | asNode ()
virtual const Node * | asNode () const
virtual NodeVisitor * | asNodeVisitor ()
virtual const NodeVisitor * | asNodeVisitor () const
virtual StateSet * | asStateSet ()
virtual const StateSet * | asStateSet () const
virtual StateAttribute * | asStateAttribute ()
virtual const StateAttribute * | asStateAttribute () const
virtual Uniform * | asUniform ()
virtual const Uniform * | asUniform () const
virtual Camera * | asCamera ()
virtual const Camera * | asCamera () const
virtual Drawable * | asDrawable ()
virtual const Drawable * | asDrawable () const
virtual Callback * | asCallback ()
virtual const Callback * | asCallback () const
virtual CallbackObject * | asCallbackObject ()
virtual const CallbackObject * | asCallbackObject () const
virtual UserDataContainer * | asUserDataContainer ()
virtual const UserDataContainer * | asUserDataContainer () const
virtual ValueObject * | asValueObject ()
virtual const ValueObject * | asValueObject () const
virtual Image * | asImage ()
virtual const Image * | asImage () const
virtual void | setThreadSafeRefUnref (bool threadSafe)
virtual void | setName (const std::string &name)
void | setName (const char *name)
const std::string & | getName () const
void | setDataVariance (DataVariance dv)
DataVariance | getDataVariance () const
virtual void | computeDataVariance ()
void | setUserDataContainer (osg::UserDataContainer *udc)
template<class T>
void | setUserDataContainer (const ref_ptr< T > &udc)
osg::UserDataContainer * | getUserDataContainer ()
const osg::UserDataContainer * | getUserDataContainer () const
osg::UserDataContainer * | getOrCreateUserDataContainer ()
template<class T>
void | setUserData (const ref_ptr< T > &ud)
template<typename T>
bool | getUserValue (const std::string &name, T &value) const
template<typename T>
void | setUserValue (const std::string &name, const T &value)
template<typename T>
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject BoundingBoxdValueObject BoundingSpheredValueObject bool | getUserValue (const std::string &name, T &value) const
Public Member Functions inherited from osg::Referenced
| Referenced ()
| Referenced (bool threadSafeRefUnref)
| Referenced (const Referenced &)
Referenced & | operator= (const Referenced &)
bool | getThreadSafeRefUnref () const
OpenThreads::Mutex * | getRefMutex () const
int | ref () const
int | unref () const
int | unref_nodelete () const
int | referenceCount () const
ObserverSet * | getObserverSet () const
ObserverSet * | getOrCreateObserverSet () const
void | addObserver (Observer *observer) const
void | removeObserver (Observer *observer) const

## Static Public Member Functions

static void | moveStateGraph (osg::State &state, StateGraph *sg_curr, StateGraph *sg_new)
static void | moveToRootStateGraph (osg::State &state, StateGraph *sg_curr)
static int | numToPop (StateGraph *sg_curr)
Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * | getGlobalReferencedMutex ()
static void | setDeleteHandler (DeleteHandler *handler)
static DeleteHandler * | getDeleteHandler ()

## Public Attributes

StateGraph * | _parent
const osg::StateSet * | _stateset
int | _depth
ChildList | _children
LeafList | _leaves
float | _averageDistance
float | _minimumDistance
osg::ref_ptr< osg::Referenced > | _userData
bool | _dynamic

## Additional Inherited Members

Protected Member Functions inherited from osg::Object
virtual | ~Object ()
Protected Member Functions inherited from osg::Referenced
virtual | ~Referenced ()
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const
void | deleteUsingDeleteHandler () const
Protected Attributes inherited from osg::Object
std::string | _name
DataVariance | _dataVariance
osg::UserDataContainer * | _userDataContainer
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr | _observerSet
OpenThreads::Atomic | _refCount

## Detailed Description

StateGraph - contained in a renderBin, defines the scene to be drawn.

## Member Typedef Documentation

## ChildList

typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> > osgUtil::StateGraph::ChildList

## LeafList

typedef std::vector< osg::ref_ptr<RenderLeaf> > osgUtil::StateGraph::LeafList

## Constructor & Destructor Documentation

## StateGraph() [1/2]

osgUtil::StateGraph::StateGraph | ( |  | ) |

inline

References _averageDistance, _depth, _dynamic, _minimumDistance, _parent, _stateset, _userData, and NULL.

Referenced by clone(), cloneStateGraph(), cloneType(), find_or_insert(), isSameKindAs(), moveStateGraph(), moveToRootStateGraph(), numToPop(), and StateGraph().

## StateGraph() [2/2]

osgUtil::StateGraph::StateGraph | ( | StateGraph * | parent,
|  | const osg::StateSet * | stateset )

inline

References _averageDistance, _depth, _dynamic, _minimumDistance, _parent, _stateset, _userData, osg::Object::DYNAMIC, osg::Object::getDataVariance(), NULL, and StateGraph().

## ~StateGraph()

osgUtil::StateGraph::~StateGraph | ( |  | ) |

inline

## Member Function Documentation

## addLeaf()

void osgUtil::StateGraph::addLeaf | ( | RenderLeaf * | leaf | ) |

inline

add a render leaf.

References _averageDistance, osgUtil::RenderLeaf::_dynamic, _dynamic, _leaves, _minimumDistance, and osgUtil::RenderLeaf::_parent.

## className()

virtual const char * osgUtil::StateGraph::className | ( |  | ) | const

inline virtual

return the name of the object's class type. Must be defined by derived classes.

Implements osg::Object.

## clean()

void osgUtil::StateGraph::clean | ( |  | ) |

Recursively clean the StateGraph of all its drawables, lights and depths. Leaves children intact, and ready to be populated again.

## clone()

virtual osg::Object * osgUtil::StateGraph::clone | ( | const osg::CopyOp & |  | ) | const

inline virtual

Clone an object, with Object* return type. Must be defined by derived classes.

Implements osg::Object.

References StateGraph().

## cloneStateGraph()

virtual StateGraph * osgUtil::StateGraph::cloneStateGraph | ( |  | ) | const

inline virtual

References StateGraph().

## cloneType()

virtual osg::Object * osgUtil::StateGraph::cloneType | ( |  | ) | const

inline virtual

Clone the type of an object, with Object* return type. Must be defined by derived classes.

Implements osg::Object.

References StateGraph().

## empty()

bool osgUtil::StateGraph::empty | ( |  | ) | const

inline

return true if all of drawables, lights and children are empty.

References _children, and _leaves.

## find_or_insert()

StateGraph * osgUtil::StateGraph::find_or_insert | ( | const osg::StateSet * | stateset | ) |

inline

References _children, and StateGraph().

## getAverageDistance()

float osgUtil::StateGraph::getAverageDistance | ( |  | ) | const

inline

References _averageDistance, and _leaves.

## getMinimumDistance()

float osgUtil::StateGraph::getMinimumDistance | ( |  | ) | const

inline

References _leaves, and _minimumDistance.

## getStateSet()

const osg::StateSet * osgUtil::StateGraph::getStateSet | ( |  | ) | const

inline

References _stateset.

Referenced by moveStateGraph(), moveToRootStateGraph(), and numToPop().

## getUserData() [1/2]

osg::Referenced * osgUtil::StateGraph::getUserData | ( |  | ) |

inline virtual

Get user data.

Reimplemented from osg::Object.

References _userData.

## getUserData() [2/2]

const osg::Referenced * osgUtil::StateGraph::getUserData | ( |  | ) | const

inline virtual

Get const user data.

Reimplemented from osg::Object.

References _userData.

## isSameKindAs()

virtual bool osgUtil::StateGraph::isSameKindAs | ( | const osg::Object * | obj | ) | const

inline virtual

Reimplemented from osg::Object.

References StateGraph().

## leaves_empty()

bool osgUtil::StateGraph::leaves_empty | ( |  | ) | const

inline

References _leaves.

## libraryName()

virtual const char * osgUtil::StateGraph::libraryName | ( |  | ) | const

inline virtual

return the name of the object's library. Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.

Implements osg::Object.

## moveStateGraph()

void osgUtil::StateGraph::moveStateGraph | ( | osg::State & | state,
|  | StateGraph * | sg_curr,
|  | StateGraph * | sg_new )

inline static

References _depth, _parent, getStateSet(), NULL, osg::State::popStateSet(), osg::State::pushStateSet(), and StateGraph().

## moveToRootStateGraph()

void osgUtil::StateGraph::moveToRootStateGraph | ( | osg::State & | state,
|  | StateGraph * | sg_curr )

inline static

References _parent, getStateSet(), osg::State::popStateSet(), and StateGraph().

## numToPop()

int osgUtil::StateGraph::numToPop | ( | StateGraph * | sg_curr | ) |

inline static

References _parent, getStateSet(), numToPop(), and StateGraph().

Referenced by numToPop().

## prune()

void osgUtil::StateGraph::prune | ( |  | ) |

Recursively prune the StateGraph of empty children.

## releaseGLObjects()

void osgUtil::StateGraph::releaseGLObjects | ( | osg::State * | = 0 | ) | const

inline virtual

If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. Otherwise, releases OpenGL objects for all graphics contexts.

Reimplemented from osg::Object.

References _children, _leaves, _stateset, and releaseGLObjects().

Referenced by releaseGLObjects().

## reset()

void osgUtil::StateGraph::reset | ( |  | ) |

Reset the internal contents of a StateGraph, including deleting all children.

## resizeGLObjectBuffers()

void osgUtil::StateGraph::resizeGLObjectBuffers | ( | unsigned int |  | ) |

inline virtual

Resize any per context GLObject buffers to specified size.

Reimplemented from osg::Object.

References _children, _leaves, and resizeGLObjectBuffers().

Referenced by resizeGLObjectBuffers().

## setStateSet()

void osgUtil::StateGraph::setStateSet | ( | const osg::StateSet * | stateset | ) |

inline

References _stateset.

## setUserData()

void osgUtil::StateGraph::setUserData | ( | osg::Referenced * | obj | ) |

inline virtual

Set user data, data must be subclassed from Referenced to allow automatic memory handling. If your own data isn't directly subclassed from Referenced then create an adapter object which points to your own object and handles the memory addressing.

Reimplemented from osg::Object.

References _userData.

## sortFrontToBack()

void osgUtil::StateGraph::sortFrontToBack | ( |  | ) |

inline

References _leaves.

## Member Data Documentation

## _averageDistance

float osgUtil::StateGraph::_averageDistance

mutable

Referenced by addLeaf(), getAverageDistance(), StateGraph(), and StateGraph().

## _children

ChildList osgUtil::StateGraph::_children

Referenced by empty(), find_or_insert(), releaseGLObjects(), and resizeGLObjectBuffers().

## _depth

int osgUtil::StateGraph::_depth

Referenced by moveStateGraph(), StateGraph(), and StateGraph().

## _dynamic

bool osgUtil::StateGraph::_dynamic

Referenced by addLeaf(), StateGraph(), and StateGraph().

## _leaves

LeafList osgUtil::StateGraph::_leaves

Referenced by addLeaf(), empty(), getAverageDistance(), getMinimumDistance(), leaves_empty(), releaseGLObjects(), resizeGLObjectBuffers(), and sortFrontToBack().

## _minimumDistance

float osgUtil::StateGraph::_minimumDistance

mutable

Referenced by addLeaf(), getMinimumDistance(), StateGraph(), and StateGraph().

## _parent

StateGraph* osgUtil::StateGraph::_parent

Referenced by moveStateGraph(), moveToRootStateGraph(), numToPop(), StateGraph(), and StateGraph().

## _stateset

const osg::StateSet* osgUtil::StateGraph::_stateset

Referenced by getStateSet(), releaseGLObjects(), setStateSet(), StateGraph(), and StateGraph().

## _userData

osg::ref_ptr<osg::Referenced> osgUtil::StateGraph::_userData

Referenced by getUserData(), getUserData(), setUserData(), StateGraph(), and StateGraph().

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

- StateGraph