SoState(3)
π SoState(3) β Library Functions Manual π
ok so bestie, welcome to the SoState page, it lives in the Library Functions Manual and it's giving β¨core Coin energyβ¨. Buckle up, this one's a long one (part 1 of 2, we're not even done yet).
πΈ NAME πΈ
SoState β the SoState class manages the Coin scenegraph traversal state data.
π SYNOPSIS π
#include <Inventor/misc/SoState.h>
π¦ Public Member Functions π¦
SoState (SoAction *action, const SoTypeList &enabledelements)
~SoState (void)
SoAction * getAction (void) const
SoElement * getElement (const int stackindex)
const SoElement * getConstElement (const int stackindex) const
void push (void)
void pop (void)
void print (FILE *const file=stdout) const
SbBool isElementEnabled (const int stackindex) const
int getDepth (void) const
void setCacheOpen (const SbBool flag)
SbBool isCacheOpen (void) const
SoElement * getElementNoPush (const int stackindex) const
β¨ Detailed Description β¨
The SoState class manages the Coin scenegraph traversal state data. periodt.
So here's the tea: the SoState class is used by actions derived from the SoAction class. It manages the scenegraph state as stacks of elements β and by elements we mean instances of classes derived from SoElement. It's stacks on stacks on stacks, no cap π«Ά
If you want the full deep lore on how traversal states work inside Coin, the manual is literally recommending the book Β«The Inventor ToolmakerΒ» (ISBN 0-201-62493-1), which is also available at SGI's online library. Just search for "Toolmaker". iykyk π
π Constructor & Destructor Documentation π
π SoState::SoState (SoAction * theAction, const SoTypeList & enabledelements)
The constructor, bestie. The theAction argument is the action object that this state is part of, and the enabledElements argument is an SoTypeList of the elements that are enabled for this action.
The constructor pushes a default element onto the indexes of all the enabled element stacks. Lowkey important: SoElement::push() is not called on the initial elements in the SoState stacks β instead, SoElement::init() is. So don't get it twisted π
References SoType::canCreateInstance(), SoType::createInstance(), SbPList::getLength(), SoElement::getNumStackIndices(), SoElement::getStackIndex(), SoElement::init(), SoType::isBad(), and SoElement::setDepth().
π§ SoState::~SoState (void )
The destructor. Say bye bye π₯²
Heads up: when destruction happens, lagging events caused by lazy evaluation won't be performed. So like, if you were counting on thoseβ¦ no you weren't π
ok that's part 1, don't go anywhere, more is coming β¨
π Member Function Documentation π
π― SoAction * SoState::getAction(void) const
Okay bestie, this one is the simplest slay on the whole page. It just hands you back the pointer to the action instance that was given to the constructor. That's it. That's the whole vibe. π«Ά
π§ SoElement * SoState::getElement(const int stackindex)
This one returns a modifyable instance of the element sitting on top of the stack with the given stackindex. But here's the tea: because of lazy programming, this function might have to do a lil work to get you there β so SoState::getConstElement() should be used instead whenever possible. β¨
ngl, if you don't actually need to write, use the const version. Save the effort, queen. π
References: SoType::createInstance(), SoElement::getDepth(), SoType::getName(), SbName::getString(), SoElement::getTypeId(), isElementEnabled(), SoDebugError::postInfo(), SoElement::push(), and SoElement::setDepth().
Referenced by: SoElement::getElement().
π const SoElement * SoState::getConstElement(const int stackIndex) const
[inline] This returns a pointer to the top element of the given element stack. The element is read-only and must not be changed under any circumstances, or strange side-effects will occur. π«
Also lowkey important: this function will assert if the element with the given stack identity value is not presently on the state stack. Wanna check whether or not an element is present in the stack? Use SoState::isElementEnabled(). π
References: isElementEnabled().
Referenced by: SoElement::getConstElement().
β¬οΈ void SoState::push(void)
This pushes the state one level down. It saves the state so it can be changed and later restored back to this state by calling SoState::pop(). π
The push and pop mechanism is performed lazily for efficiency reasons (it avoids a whole lot of memory allocation and copying). Only when a state element is actually going to be changed does that element get pushed for real. Efficiency? Obsessed. π
References: SoElement::depth.
Referenced by: SoSeparator::audioRender(), SoVRMLGroup::audioRender(), SoShape::beginSolidShape(), SoHandleEventAction::beginTraversal(), SoPickAction::beginTraversal(), SoRayPickAction::beginTraversal(), SoDragger::callback(), SoGeoSeparator::callback(), SoSeparator::callback(), SoVRMLGroup::callback(), SoVRMLTransform::callback(), SoArray::doAction(), SoMultipleCopy::doAction(), SoSeparator::doAction(), SoVRMLBillboard::doAction(), SoVRMLGroup::doAction(), SoVRMLShape::doAction(), SoVRMLTransform::doAction(), SoVertexShape::generateAndReadLockNormalCache(), SoVRMLVertexShape::generateAndReadLockNormalCache(), SoFaceSet::generatePrimitives(), SoImage::generatePrimitives(), SoIndexedFaceSet::generatePrimitives(), SoIndexedTriangleStripSet::generatePrimitives(), SoLineSet::generatePrimitives(), SoPointSet::generatePrimitives(), SoQuadMesh::generatePrimitives(), SoTriangleStripSet::generatePrimitives(), SoVRMLExtrusion::generatePrimitives(), SoVRMLIndexedFaceSet::generatePrimitives(), SoVRMLIndexedLineSet::generatePrimitives(), SoArray::getBoundingBox(), SoGeoSeparator::getBoundingBox(), SoLevelOfDetail::getBoundingBox(), SoSeparator::getBoundingBox(), SoVRMLBillboard::getBoundingBox(), SoVRMLGroup::getBoundingBox(), SoVRMLShape::getBoundingBox(), SoVRMLTransform::getBoundingBox(), SoSeparator::getMatrix(), SoVRMLTransform::getMatrix(), SoDragger::getPrimitiveCount(), SoGeoSeparator::getPrimitiveCount(), SoMarkerSet::getPrimitiveCount(), SoVRMLGroup::getPrimitiveCount(), SoVRMLTransform::getPrimitiveCount(), SoDragger::GLRender(), SoFaceSet::GLRender(), SoIndexedFaceSet::GLRender(), SoIndexedLineSet::GLRender(), SoIndexedNurbsCurve::GLRender(), SoIndexedTriangleStripSet::GLRender(), SoLineSet::GLRender(), SoMarkerSet::GLRender(), SoNurbsCurve::GLRender(), SoPointSet::GLRender(), SoQuadMesh::GLRender(), SoShape::GLRender(), SoText2::GLRender(), SoTriangleStripSet::GLRender(), SoVRMLBackground::GLRender(), SoVRMLCollision::GLRender(), SoVRMLElevationGrid::GLRender(), SoVRMLExtrusion::GLRender(), SoVRMLIndexedFaceSet::GLRender(), SoVRMLIndexedLineSet::GLRender(), SoVRMLInline::GLRender(), SoVRMLShape::GLRender(), SoWWWInline::GLRender(), SoExtSelection::GLRenderBelowPath(), SoGeoSeparator::GLRenderBelowPath(), SoLocateHighlight::GLRenderBelowPath(), SoSeparator::GLRenderBelowPath(), SoVRMLBillboard::GLRenderBelowPath(), SoVRMLGroup::GLRenderBelowPath(), SoVRMLTransform::GLRenderBelowPath(), SoGeoSeparator::GLRenderInPath(), SoLocateHighlight::GLRenderInPath(), SoSeparator::GLRenderInPath(), SoVRMLBillboard::GLRenderInPath(), SoVRMLGroup::GLRenderInPath(), SoVRMLTransform::GLRenderInPath(), SoVRMLAnchor::handleEvent(), SoDragger::rayPick(), SoGeoSeparator::rayPick(), SoIndexedNurbsCurve::rayPick(), SoIndexedNurbsSurface::rayPick(), SoNurbsCurve::rayPick(), SoNurbsSurface::rayPick(), SoVRMLTransform::rayPick(), SoArray::search(), SoMultipleCopy::search(), SoVertexShape::setNormalCache(), and SoShape::shouldGLRender().
β¬οΈ void SoState::pop(void)
This pops the state to restore it to a previous state. Pops are performed eagerly, but the code is very tight so there is no reason to worry about efficiency. It's giving optimized. π₯
References: SoElement::pop().
Referenced by: SoSeparator::audioRender(), SoVRMLGroup::audioRender(), SoHandleEventAction::beginTraversal(), SoPickAction::beginTraversal(), SoRayPickAction::beginTraversal(), SoDragger::callback(), SoGeoSeparator::callback(), SoSeparator::callback(), SoVRMLGroup::callback(), SoVRMLTransform::callback(), SoArray::doAction(), SoMultipleCopy::doAction(), SoSeparator::doAction(), SoVRMLBillboard::doAction(), SoVRMLGroup::doAction(), SoVRMLShape::doAction(), SoVRMLTransform::doAction(), SoShape::endSolidShape(), SoVertexShape::generateAndReadLockNormalCache(), SoVRMLVertexShape::generateAndReadLockNormalCache(), SoFaceSet::generatePrimitives(), SoImage::generatePrimitives(), SoIndexedFaceSet::generatePrimitives(), SoIndexedTriangleStripSet::generatePrimitives(), SoLineSet::generatePrimitives(), SoPointSet::generatePrimitives(), SoQuadMesh::generatePrimitives(), SoTriangleStripSet::generatePrimitives(), SoVRMLExtrusion::generatePrimitives(), SoVRMLIndexedFaceSet::generatePrimitives(), SoVRMLIndexedLineSet::generatePrimitives(), SoArray::getBoundingBox(), SoGeoSeparator::getBoundingBox(), SoLevelOfDetail::getBoundingBox(), SoSeparator::getBoundingBox(), SoVRMLBillboard::getBoundingBox(), SoVRMLGroup::getBoundingBox(), SoVRMLShape::getBoundingBox(), SoVRMLTransform::getBoundingBox(), SoSeparator::getMatrix(), SoVRMLTransform::getMatrix(), SoDragger::getPrimitiveCount(), SoGeoSeparator::getPrimitiveCount(), SoMarkerSet::getPrimitiveCount(), SoVRMLGroup::getPrimitiveCount(), SoVRMLTransform::getPrimitiveCount(), SoDragger::GLRender(), SoFaceSet::GLRender(), SoIndexedFaceSet::GLRender(), SoIndexedLineSet::GLRender(), SoIndexedNurbsCurve::GLRender(), SoIndexedTriangleStripSet::GLRender(), SoLineSet::GLRender(), SoMarkerSet::GLRender(), SoNurbsCurve::GLRender(), SoPointSet::GLRender(), SoQuadMesh::GLRender(), SoShape::GLRender(), SoText2::GLRender(), SoTriangleStripSet::GLRender(), SoVRMLBackground::GLRender(), SoVRMLCollision::GLRender(), SoVRMLElevationGrid::GLRender(), SoVRMLExtrusion::GLRender(), SoVRMLIndexedFaceSet::GLRender(), SoVRMLIndexedLineSet::GLRender(), SoVRMLInline::GLRender(), SoVRMLShape::GLRender(), SoWWWInline::GLRender(), SoExtSelection::GLRenderBelowPath(), SoGeoSeparator::GLRenderBelowPath(), SoLocateHighlight::GLRenderBelowPath(), SoSeparator::GLRenderBelowPath(), SoVRMLBillboard::GLRenderBelowPath(), SoVRMLGroup::GLRenderBelowPath(), SoVRMLTransform::GLRenderBelowPath(), SoGeoSeparator::GLRenderInPath(), SoLocateHighlight::GLRenderInPath(), SoSeparator::GLRenderInPath(), SoVRMLBillboard::GLRenderInPath(), SoVRMLGroup::GLRenderInPath(), SoVRMLTransform::GLRenderInPath(), SoVRMLAnchor::handleEvent(), SoDragger::rayPick(), SoGeoSeparator::rayPick(), SoIndexedNurbsCurve::rayPick(), SoIndexedNurbsSurface::rayPick(), SoNurbsCurve::rayPick(), SoNurbsSurface::rayPick(), SoVRMLTransform::rayPick(), SoArray::search(), SoMultipleCopy::search(), SoVertexShape::setNormalCache(), and SoShape::shouldGLRender().
π¨οΈ void SoState::print(FILE *const file = stdout) const
This method is just for debugging purposes. That's the whole job, bestie. π
References: SoType::getName(), SbName::getString(), and SoElement::getTypeId().
β
SbBool SoState::isElementEnabled(const int stackindex) const
[inline] Returns TRUE if the element with the given element stack index is enabled, and FALSE otherwise. Simple as that. π
Referenced by: SoBaseColor::doAction(), SoMaterial::doAction(), SoPackedColor::doAction(), SoVRMLColor::doAction(), SoVRMLShape::doAction(), getConstElement(), getElement(), SoAsciiText::GLRender(), SoText3::GLRender(), and SoSurroundScale::updateMySurroundParams().
π int SoState::getDepth(void) const
Returns the current depth of the state stack. π
Heads up tho: the depth is "virtual", not necessarily physical. It's giving main character energy but make it abstract. β¨
Referenced by: SoSceneManager::processEvent().
ποΈ void SoState::setCacheOpen(const SbBool open)
Controls whether a cache is open. π«Ά
π SbBool SoState::isCacheOpen(void) const
[inline] Returns whether a cache is open. π
Referenced by: SoElement::capture(), SoSceneTexture2::GLRender(), SoTexture2::GLRender(), SoTextureCubeMap::GLRender(), SoVRMLImageTexture::GLRender(), SoVRMLPixelTexture::GLRender(), SoSeparator::GLRenderBelowPath(), SoVRMLGroup::GLRenderBelowPath(), SoGLRenderAction::handleTransparency(), and SoShape::shouldGLRender().
β¨ Author β¨
Generated automatically by Doxygen for Coin from the source code. π€
And that's a wrap on the SoState(3) girlies! This whole glow-up came straight from the Coin source code, page SoState(3), Version 2.5.0 β no date on this one, just vibes and reference lists. Stay lazy, stay pushed, and always pop() what you push(). ππ¦
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms