.TH "SoReorganizeAction" 3 "Tue Dec 26 2023 17:59:22" "Version 4.0.2" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoReorganizeAction \- The \fBSoReorganizeAction\fP class reorganizes your scene graph to optimize traversal/rendering\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoSimplifyAction\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBvirtual\fP \fBSoType\fP \fBgetTypeId\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoReorganizeAction\fP (\fBSoSimplifier\fP *\fBsimplifier\fP=\fBNULL\fP)" .br .ti -1c .RI "\fBvirtual\fP \fB~SoReorganizeAction\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBSoSeparator\fP * \fBgetSimplifiedSceneGraph\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBgenerateNormals\fP (SbBool \fBonoff\fP)" .br .ti -1c .RI "SbBool \fBareNormalGenerated\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBgenerateTriangleStrips\fP (SbBool \fBonoff\fP)" .br .ti -1c .RI "SbBool \fBareTriangleStripGenerated\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBgenerateTexCoords\fP (SbBool \fBonoff\fP)" .br .ti -1c .RI "SbBool \fBareTexCoordsGenerated\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBgenerateVPNodes\fP (SbBool \fBonoff\fP)" .br .ti -1c .RI "SbBool \fBareVPNodesGenerated\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBmatchIndexArrays\fP (SbBool \fBonoff\fP)" .br .ti -1c .RI "SbBool \fBareIndexArraysMatched\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoSimplifier\fP * \fBgetSimplifier\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBapply\fP (\fBSoNode\fP *root)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBapply\fP (\fBSoPath\fP *path)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBapply\fP (\fBconst\fP \fBSoPathList\fP &\fBpathlist\fP, SbBool \fBobeysrules\fP=FALSE)" .br .in -1c Public Member Functions inherited from \fBSoSimplifyAction\fP .in +1c .ti -1c .RI "\fBSoSimplifyAction\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fB~SoSimplifyAction\fP (\fBvoid\fP)" .br .in -1c Public Member Functions inherited from \fBSoAction\fP .in +1c .ti -1c .RI "\fBvirtual\fP \fB~SoAction\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP SbBool \fBisOfType\fP (\fBSoType\fP type) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBapply\fP (\fBSoAction\fP *\fBbeingApplied\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBinvalidateState\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBAppliedCode\fP \fBgetWhatAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoNode\fP * \fBgetNodeAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoPath\fP * \fBgetPathAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBconst\fP \fBSoPathList\fP * \fBgetPathListAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBconst\fP \fBSoPathList\fP * \fBgetOriginalPathListAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBisLastPathListAppliedTo\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBPathCode\fP \fBgetPathCode\fP (int &\fBnumindices\fP, \fBconst\fP int *&indices)" .br .ti -1c .RI "\fBvoid\fP \fBtraverse\fP (\fBSoNode\fP *\fBconst\fP node)" .br .ti -1c .RI "SbBool \fBhasTerminated\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBconst\fP \fBSoPath\fP * \fBgetCurPath\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBSoState\fP * \fBgetState\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBPathCode\fP \fBgetCurPathCode\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoNode\fP * \fBgetCurPathTail\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBusePathCode\fP (int &\fBnumindices\fP, \fBconst\fP int *&indices)" .br .ti -1c .RI "\fBvoid\fP \fBpushCurPath\fP (\fBconst\fP int \fBchildindex\fP, \fBSoNode\fP *node=\fBNULL\fP)" .br .ti -1c .RI "\fBvoid\fP \fBpopCurPath\fP (\fBconst\fP \fBPathCode\fP \fBprevpathcode\fP)" .br .ti -1c .RI "\fBvoid\fP \fBpushCurPath\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBpopPushCurPath\fP (\fBconst\fP int \fBchildindex\fP, \fBSoNode\fP *node=\fBNULL\fP)" .br .ti -1c .RI "\fBvoid\fP \fBpopCurPath\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBswitchToPathTraversal\fP (\fBSoPath\fP *path)" .br .ti -1c .RI "\fBvoid\fP \fBswitchToNodeTraversal\fP (\fBSoNode\fP *node)" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBaddMethod\fP (\fBconst\fP \fBSoType\fP type, SoActionMethod method)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBenableElement\fP (\fBconst\fP \fBSoType\fP type, \fBconst\fP int \fBstackindex\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBstartReport\fP (\fBconst\fP char *\fBmsg\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBfinishReport\fP (\fBvoid\fP)" .br .in -1c Static Public Member Functions inherited from \fBSoSimplifyAction\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBaddMethod\fP (\fBconst\fP \fBSoType\fP type, SoActionMethod method)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBenableElement\fP (\fBconst\fP \fBSoType\fP type, \fBconst\fP int \fBstackindex\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .in -1c Static Public Member Functions inherited from \fBSoAction\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClasses\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBnullAction\fP (\fBSoAction\fP *action, \fBSoNode\fP *node)" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBvirtual\fP \fBconst\fP \fBSoEnabledElementsList\fP & \fBgetEnabledElements\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBbeginTraversal\fP (\fBSoNode\fP *node)" .br .in -1c Protected Member Functions inherited from \fBSoAction\fP .in +1c .ti -1c .RI "\fBSoAction\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBendTraversal\fP (\fBSoNode\fP *node)" .br .ti -1c .RI "\fBvoid\fP \fBsetTerminated\fP (\fBconst\fP SbBool \fBflag\fP)" .br .ti -1c .RI "\fBvirtual\fP SbBool \fBshouldCompactPathList\fP (\fBvoid\fP) \fBconst\fP" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBSoEnabledElementsList\fP * \fBgetClassEnabledElements\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoActionMethodList\fP * \fBgetClassActionMethods\fP (\fBvoid\fP)" .br .in -1c Static Protected Member Functions inherited from \fBSoSimplifyAction\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBSoEnabledElementsList\fP * \fBgetClassEnabledElements\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoActionMethodList\fP * \fBgetClassActionMethods\fP (\fBvoid\fP)" .br .in -1c Static Protected Member Functions inherited from \fBSoAction\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBSoEnabledElementsList\fP * \fBgetClassEnabledElements\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoActionMethodList\fP * \fBgetClassActionMethods\fP (\fBvoid\fP)" .br .in -1c .SS "Additional Inherited Members" Public Types inherited from \fBSoAction\fP .in +1c .ti -1c .RI "enum \fBAppliedCode\fP { \fBNODE\fP = 0, \fBPATH\fP = 1, \fBPATH_LIST\fP = 2 }" .br .ti -1c .RI "enum \fBPathCode\fP { \fBNO_PATH\fP = 0, \fBIN_PATH\fP = 1, \fBBELOW_PATH\fP = 2, \fBOFF_PATH\fP = 3 }" .br .in -1c Protected Attributes inherited from \fBSoAction\fP .in +1c .ti -1c .RI "\fBSoState\fP * \fBstate\fP" .br .ti -1c .RI "\fBSoActionMethodList\fP * \fBtraversalMethods\fP" .br .in -1c .SH "Detailed Description" .PP The \fBSoReorganizeAction\fP class reorganizes your scene graph to optimize traversal/rendering\&. Note\&. This is work-in-progress\&. pederb, 2005-04-05\&. .PP The code below is an example of a program that applies an \fBSoReorganizeAction\fP on a scene graph, converting all shapes into shapes that can be rendered using vertex array or VBO rendering\&. .PP .PP .nf #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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 [nostrip]\\n"); return \-1; } SbBool strip = TRUE; if (argc > 3) { if (strcmp(argv[3], "nostrip") == 0) strip = FALSE; else { fprintf(stderr,"Usage: reorganize [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() .fi .PP .PP \fBSince\fP .RS 4 Coin \fB2\&.5\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "SoReorganizeAction::SoReorganizeAction (\fBSoSimplifier\fP * simplifier = \fC\fBNULL\fP\fP)" A constructor\&. .SS "SoReorganizeAction::~SoReorganizeAction (\fBvoid\fP)\fC [virtual]\fP" The destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoReorganizeAction::getTypeId (\fBvoid\fP) const\fC [virtual]\fP" Returns the type identification of an object derived from a class inheriting \fBSoAction\fP\&. This is used for runtime type checking and 'downward' casting\&. .br .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SS "\fBSoType\fP SoReorganizeAction::getClassTypeId (\fBvoid\fP)\fC [static]\fP" This static method returns the \fBSoType\fP object associated with objects of this class\&. .br .SS "\fBvoid\fP SoReorganizeAction::addMethod (\fBconst\fP \fBSoType\fP type, SoActionMethod method)\fC [static]\fP" \fIThis API member is considered internal to the library, as it is not likely to be of interest to the application programmer\&.\fP .br .br .SS "\fBvoid\fP SoReorganizeAction::enableElement (\fBconst\fP \fBSoType\fP type, \fBconst\fP int stackindex)\fC [static]\fP" \fIThis API member is considered internal to the library, as it is not likely to be of interest to the application programmer\&.\fP .br .br .SS "\fBconst\fP \fBSoEnabledElementsList\fP & SoReorganizeAction::getEnabledElements (\fBvoid\fP) const\fC [protected]\fP, \fC [virtual]\fP" Returns list of enabled elements\&. .br .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SS "\fBSoEnabledElementsList\fP * SoReorganizeAction::getClassEnabledElements (\fBvoid\fP)\fC [static]\fP, \fC [protected]\fP" Returns list of enabled elements for this class\&. The enabledElements and methods variables are protected in the original OIV API\&. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs\&. This function is an extension for Coin, and it is not available in the original SGI Open Inventor \fBv2\&.1\fP API\&. .br .br .SS "\fBSoActionMethodList\fP * SoReorganizeAction::getClassActionMethods (\fBvoid\fP)\fC [static]\fP, \fC [protected]\fP" Returns list of action methods for this class\&. The enabledElements and methods variables are protected in the original OIV API\&. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs\&. This function is an extension for Coin, and it is not available in the original SGI Open Inventor \fBv2\&.1\fP API\&. .br .br .SS "\fBvoid\fP SoReorganizeAction::initClass (\fBvoid\fP)\fC [static]\fP" Initializes the runtime type system for this class, and sets up the enabled elements and action method list\&. .SS "\fBvoid\fP SoReorganizeAction::apply (\fBSoNode\fP * root)\fC [virtual]\fP" Applies the action to the scene graph rooted at \fIroot\fP\&. .PP Note that you should \fInot\fP apply an action to a node with a zero reference count\&. The behavior in that case is undefined\&. .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SS "\fBvoid\fP SoReorganizeAction::apply (\fBSoPath\fP * path)\fC [virtual]\fP" Applies the action to the parts of the graph defined by \fIpath\fP\&. .PP Note that an \fBSoPath\fP will also contain all nodes that may influence e\&.g\&. geometry nodes in the path\&. So for instance applying an \fBSoGLRenderAction\fP on an \fBSoPath\fP will render that path as expected in the view, where geometry will get its materials, textures, and other appearance settings correctly\&. .PP If the \fIpath\fP ends in an \fBSoGroup\fP node, the action will also traverse the tail node's children\&. .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SS "\fBvoid\fP SoReorganizeAction::apply (\fBconst\fP \fBSoPathList\fP & pathlist, SbBool obeysrules = \fCFALSE\fP)\fC [virtual]\fP" Applies action to the graphs defined by \fIpathlist\fP\&. If \fIobeysrules\fP is set to \fCTRUE\fP, \fIpathlist\fP 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): .PP 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\&. .PP \fBSee also\fP .RS 4 \fBSoAction::apply(SoPath * path)\fP .RE .PP .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SS "\fBvoid\fP SoReorganizeAction::beginTraversal (\fBSoNode\fP * node)\fC [protected]\fP, \fC [virtual]\fP" This virtual method is called from \fBSoAction::apply()\fP, and is the entry point for the actual scene graph traversal\&. .PP It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting \fBSoAction\fP\&. .PP Default method just calls \fBtraverse()\fP, which any overridden implementation of the method must do too (or call \fBSoAction::beginTraversal()\fP) to trigger the scene graph traversal\&. .PP Reimplemented from \fBSoSimplifyAction\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.