Open Inventor Reference
|
An SoState collects and holds state while traversing a scene graph. More...
#include <Inventor/misc/SoState.h>
Public Member Functions | |
SoState (SoAction *action, const SoTypeList &enabledElements) | |
Constructor. | |
~SoState () | |
Destructor. | |
SoAction * | getAction () const |
Returns the action instance the state is part of. | |
SoElement * | getElement (int stackIndex) |
Returns a writable instance of the element on the top of the stack with the given index. | |
const SoElement * | getConstElement (int stackIndex) const |
Returns the top (read-only) instance of the given element stack. | |
void | push () |
Pushes (saves) the current state until a pop() restores it. | |
void | pop () |
Pops the state, restoring the state to just before the last push(). | |
void | print (FILE *fp) |
Prints state to file (for debugging) | |
bool | isElementEnabled (int stackIndex) const |
Returns TRUE if element with given stack index is enabled in state. | |
int | getDepth () const |
Returns current depth of state. | |
void | setCacheOpen (bool flag) |
Sets/returns flag that indicates whether a cache is open. | |
bool | isCacheOpen () const |
SoElement * | getElementNoPush (int stackIndex) const |
Internal-only, dangerous method that returns a writeable element without checking for state depth and doing a push. | |
A state is composed of a variety of elements, each of which holds some specific information, such as coordinates or diffuse color of the surface material.
Each element is stored in its own stack so that save and restore can be implemented as push and pop. These stack operations are performed lazily, so that pushing of a value occurs only when the value would be overwritten, for efficiency.
SoState::SoState | ( | SoAction * | action, |
const SoTypeList & | enabledElements | ||
) |
Takes pointer to action instance this state is part of and a list of type-ids of elements that are enabled.
SoState::~SoState | ( | ) |
|
inline |
Definition at line 100 of file SoState.h.
Referenced by SoElement::getConstElement(), and SoGLLazyElement::getInstance().
SoElement * SoState::getElement | ( | int | stackIndex | ) |
Referenced by SoElement::getElement(), and SoLazyElement::getWInstance().
|
inline |
Be very careful and consider the caching implications before using this method!
Definition at line 135 of file SoState.h.
Referenced by SoCacheElement::getCurrentCache(), SoLazyElement::getInstance(), SoGLCacheContextElement::resetAutoCacheBits(), SoGLCacheContextElement::setAutoCacheBits(), and SoGLCacheContextElement::shouldAutoCache().
|
inline |
Definition at line 129 of file SoState.h.
Referenced by SoElement::capture(), SoGLLazyElement::send(), SoGLLazyElement::sendAllMaterial(), SoGLLazyElement::sendNoMaterial(), and SoGLLazyElement::sendOnlyDiffuseColor().
|
inline |
void SoState::pop | ( | ) |
void SoState::print | ( | FILE * | fp | ) |
|
inline |
The push is done lazily: this just increments the depth in the state. When an element is accessed with getElement() and its depth is less than the current depth, it is then pushed individually.
|
inline |