SoReorganizeAction(3)
π SoReorganizeAction(3) π
okay so bestie, welcome to the SoReorganizeAction(3) man page from Coin πΈ β this is part 1 of 2, so buckle up, hydrate, and let's get into it.
β¨ NAME β¨
SoReorganizeAction β the class that reorganizes your scene graph to optimize traversal/rendering. that's the whole personality. π¦
π SYNOPSIS π
#include <Inventor/actions/SoReorganizeAction.h>
Inherits SoSimplifyAction.
π Public Member Functions
virtual SoType getTypeId (void) constβ the type-id getter, iconic.SoReorganizeAction (SoSimplifier *simplifier=NULL)β the constructor, andsimplifierdefaults toNULL.virtual ~SoReorganizeAction (void)β the destructor.SoSeparator * getSimplifiedSceneGraph (void) constβ hands you the simplified scene graph back.void generateNormals (SbBool onoff)β normal generation,onoffstyle.SbBool areNormalGenerated (void) constβ are the normals generated? asks.void generateTriangleStrips (SbBool onoff)β triangle strip generation,onoff.SbBool areTriangleStripGenerated (void) constβ are the triangle strips generated?void generateTexCoords (SbBool onoff)β tex coord generation,onoff.SbBool areTexCoordsGenerated (void) constβ are the tex coords generated?void generateVPNodes (SbBool onoff)β VP node generation,onoff.SbBool areVPNodesGenerated (void)β are the VP nodes generated? (and ngl bestie, this one has noconston it, unlike its siblings π)void matchIndexArrays (SbBool onoff)β index array matching,onoff.SbBool areIndexArraysMatched (void) constβ are the index arrays matched?SoSimplifier * getSimplifier (void) constβ grab the simplifier.virtual void apply (SoNode *root)β apply it,SoNode *edition.virtual void apply (SoPath *path)β apply it,SoPath *edition.virtual void apply (const SoPathList &pathlist, SbBool obeysrules=FALSE)β apply it to a wholeSoPathList, andobeysrulesdefaults toFALSE.
π Public Member Functions inherited from SoSimplifyAction
SoSimplifyAction (void)virtual ~SoSimplifyAction (void)
π Public Member Functions inherited from SoAction
virtual ~SoAction (void)virtual SbBool isOfType (SoType type) constvoid apply (SoAction *beingApplied)virtual void invalidateState (void)AppliedCode getWhatAppliedTo (void) constSoNode * getNodeAppliedTo (void) constSoPath * getPathAppliedTo (void) constconst SoPathList * getPathListAppliedTo (void) constconst SoPathList * getOriginalPathListAppliedTo (void) constSbBool isLastPathListAppliedTo (void) constPathCode getPathCode (int &numindices, const int *&indices)void traverse (SoNode *const node)SbBool hasTerminated (void) constconst SoPath * getCurPath (void)SoState * getState (void) constPathCode getCurPathCode (void) constvirtual SoNode * getCurPathTail (void)void usePathCode (int &numindices, const int *&indices)void pushCurPath (const int childindex, SoNode *node=NULL)void popCurPath (const PathCode prevpathcode)void pushCurPath (void)void popPushCurPath (const int childindex, SoNode *node=NULL)void popCurPath (void)void switchToPathTraversal (SoPath *path)void switchToNodeTraversal (SoNode *node)
β Static Public Member Functions
static SoType getClassTypeId (void)static void addMethod (const SoType type, SoActionMethod method)static void enableElement (const SoType type, const int stackindex)static void initClass (void)static void startReport (const char *msg)static void finishReport (void)
π Static Public Member Functions inherited from SoSimplifyAction
static SoType getClassTypeId (void)static void addMethod (const SoType type, SoActionMethod method)static void enableElement (const SoType type, const int stackindex)static void initClass (void)
π Static Public Member Functions inherited from SoAction
static void initClass (void)static void initClasses (void)static SoType getClassTypeId (void)static void nullAction (SoAction *action, SoNode *node)
π«§ Protected Member Functions
virtual const SoEnabledElementsList & getEnabledElements (void) constvirtual void beginTraversal (SoNode *node)
π Protected Member Functions inherited from SoAction
SoAction (void)virtual void endTraversal (SoNode *node)void setTerminated (const SbBool flag)virtual SbBool shouldCompactPathList (void) const
π Static Protected Member Functions
static SoEnabledElementsList * getClassEnabledElements (void)static SoActionMethodList * getClassActionMethods (void)
π Static Protected Member Functions inherited from SoSimplifyAction
static SoEnabledElementsList * getClassEnabledElements (void)static SoActionMethodList * getClassActionMethods (void)
π Static Protected Member Functions inherited from SoAction
static SoEnabledElementsList * getClassEnabledElements (void)static SoActionMethodList * getClassActionMethods (void)
πΈ Additional Inherited Members
Public Types inherited from SoAction
enum AppliedCode { NODE = 0, PATH = 1, PATH_LIST = 2 }enum PathCode { NO_PATH = 0, IN_PATH = 1, BELOW_PATH = 2, OFF_PATH = 3 }
Protected Attributes inherited from SoAction
SoState * stateSoActionMethodList * traversalMethods
π«Ά DETAILED DESCRIPTION π«Ά
The SoReorganizeAction class reorganizes your scene graph to optimize traversal/rendering. that's it, that's the assignment. π
Note. This is work-in-progress. pederb, 2005-04-05.
The code below is an example of a program that applies an SoReorganizeAction on a scene graph, converting all shapes into shapes that can be rendered using vertex array or VBO rendering. π₯
#include <Inventor/SoDB.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoCoordinate4.h>
#include <Inventor/nodes/SoNormal.h>
#include <Inventor/nodes/SoTextureCoordinate2.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/actions/SoWriteAction.h>
#include <Inventor/actions/SoSearchAction.h>
#include <Inventor/errors/SoDebugError.h>
#include <Inventor/nodes/SoShapeHints.h>
#include <Inventor/SoInput.h>
#include <Inventor/SoOutput.h>
#include <Inventor/SoInteraction.h>
#include <Inventor/actions/SoReorganizeAction.h>
#include <cassert>
#include <cstdio>
static void strip_node(SoType type, SoNode * root)
{
SoSearchAction sa;
sa.setType(type);
sa.setSearchingAll(TRUE);
sa.setInterest(SoSearchAction::ALL);
sa.apply(root);
SoPathList & pl = sa.getPaths();
for (int i = 0; i < pl.getLength(); i++) {
SoFullPath * p = (SoFullPath*) pl[i];
if (p->getTail()->isOfType(type)) {
SoGroup * g = (SoGroup*) p->getNodeFromTail(1);
g->removeChild(p->getIndexFromTail(0));
}
}
sa.reset();
}
int
main(int argc, char ** argv )
{
if (argc < 3) {
fprintf(stderr,"Usage: reorganize <infile> <outfile> [nostrip]\n");
return -1;
}
SbBool strip = TRUE;
if (argc > 3) {
if (strcmp(argv[3], "nostrip") == 0) strip = FALSE;
else {
fprintf(stderr,"Usage: reorganize <infile> <outfile> [nostrip]\n");
return -1;
}
}
SoDB::init();
SoInteraction::init();
SoInput input;
SbBool ok = input.openFile(argv[1]);
if (!ok) {
fprintf(stderr,"Unable to open file.\n");
return -1;
}
SoSeparator * root = SoDB::readAll(&input);
SbBool vrml1 = input.isFileVRML1();
SbBool vrml2 = input.isFileVRML2();
if (vrml2) {
fprintf(stderr,"VRML2 not supported yet\n");
return -1;
}
if (!root) {
fprintf(stderr,"Unable to read file.\n");
return -1;
}
root->ref();
fprintf(stderr,"Applying SoReorganizeAction...");
SoReorganizeAction reorg;
reorg.apply(root);
fprintf(stderr,"done\n");
SoOutput out;
if (out.openFile(argv[2])) {
if (strip) { // strip coord3, texcoord and normal nodes
fprintf(stderr,"stripping old nodes from scene graph\n");
strip_node(SoCoordinate3::getClassTypeId(), root);
strip_node(SoCoordinate4::getClassTypeId(), root);
strip_node(SoNormal::getClassTypeId(), root);
strip_node(SoTextureCoordinate2::getClassTypeId(), root);
}
fprintf(stderr,"writing target\n");
SoWriteAction wa(&out);
wa.apply(root);
}
root->unref();
return 0;
} // main()
Since
Coin 2.5 β¨
π§ Constructor & Destructor Documentation π§
SoReorganizeAction::SoReorganizeAction (SoSimplifier * simplifier = NULL)
A constructor. π«Ά
SoReorganizeAction::~SoReorganizeAction (void ) [virtual]
The destructor. π
π Member Function Documentation π
π SoType SoReorganizeAction::getTypeId (void) const [virtual]
Okay bestie, this one hands you the type identification of an object derived from a class inheriting SoAction. What's it for? Runtime type checking and "downward" casting β iconic behavior, no notes. π
Reimplemented from SoSimplifyAction.
β¨ SoType SoReorganizeAction::getClassTypeId (void) [static]
This static method returns the SoType object associated with objects of this class. That's it, that's the whole vibe. π
π¦ void SoReorganizeAction::addMethod (const SoType type, SoActionMethod method) [static]
Real talk: this API member is considered internal to the library, because it is not likely to be of interest to the application programmer. So likeβ¦ not your problem, bestie. π
πΈ void SoReorganizeAction::enableElement (const SoType type, const int stackindex) [static]
Same energy as above: this API member is considered internal to the library, since it is not likely to be of interest to the application programmer. Move along, nothing for you here. π
π const SoEnabledElementsList & SoReorganizeAction::getEnabledElements (void) const [protected], [virtual]
Returns the list of enabled elements. Short, sweet, slay.
Reimplemented from SoSimplifyAction.
π SoEnabledElementsList * SoReorganizeAction::getClassEnabledElements (void) [static], [protected]
Returns the list of enabled elements for this class.
Now here's the tea: the enabledElements and methods variables are protected in the original OIV API. And honestly? That was not such a good idea, because exposed static class member variables are a major grievance with regard to Win32 DLLs. π
So this function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. Iykyk. π«Ά
π SoActionMethodList * SoReorganizeAction::getClassActionMethods (void) [static], [protected]
Returns the list of action methods for this class.
And yes, same disclaimer, because the lore repeats: the enabledElements and methods variables are protected in the original OIV API. Not a good idea, since exposed static class member variables are a major grievance with regard to Win32 DLLs.
This one is also an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. Periodt. π
β void SoReorganizeAction::initClass (void) [static]
Initializes the runtime type system for this class, and sets up the enabled elements and action method list. Basically the glow-up setup before the main character moment. β¨
π void SoReorganizeAction::apply (SoNode * root) [virtual]
Applies the action to the scene graph rooted at root.
β οΈ Important caveat, bestie: you should not apply an action to a node with a zero reference count. The behavior in that case is undefined. So don't do it. Fr fr.
Reimplemented from SoSimplifyAction.
π¦ void SoReorganizeAction::apply (SoPath * path) [virtual]
Applies the action to the parts of the graph defined by path.
Heads up: an SoPath will also contain all nodes that may influence e.g. geometry nodes in the path. So for instance, applying an SoGLRenderAction on an SoPath will render that path as expected in the view, where geometry will get its materials, textures, and other appearance settings correctly. Iconic behavior, honestly. π
And if the path ends in an SoGroup node, the action will also traverse the tail node's children. The more you know. π
Reimplemented from SoSimplifyAction.
π void SoReorganizeAction::apply (const SoPathList & pathlist, SbBool obeysrules = FALSE) [virtual]
Applies the action to the graphs defined by pathlist.
If obeysrules is set to TRUE, then pathlist must obey the following four conditions β which is the case for path lists returned from search actions for non-group nodes and path lists returned from picking actions:
- All paths must start at the same head node.
- All paths must be sorted in traversal order.
- The paths must be unique.
- No path can continue through the end point of another path.
See also: SoAction::apply(SoPath * path)
Reimplemented from SoSimplifyAction.
πΈ void SoReorganizeAction::beginTraversal (SoNode * node) [protected], [virtual]
This virtual method is called from SoAction::apply(), and it is the entry point for the actual scene graph traversal. Main character energy, obviously. π
It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.
The default method just calls traverse(), which any overridden implementation of the method must do too β or call SoAction::beginTraversal() β to trigger the scene graph traversal. Don't skip that part, bestie. π«Ά
Reimplemented from SoSimplifyAction.
π Author π
Generated automatically by Doxygen for Coin from the source code.
And that's a wrap on SoReorganizeAction(3), my love. π This was Version 4.0.10, dated Thu Jun 25 2026 00:00:00, and you ate every single line of it. Go forth and reorganize, you absolute legend. π
β¨
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms