SoGetPrimitiveCountAction(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SoGetPrimitiveCountAction πŸ’– β€” like, the Coin man page, section 3, bestie

okay so. welcome to SoGetPrimitiveCountAction(3), a Coin manual page, and yes we're doing this together, hand in hand, no cap. this is part 1 and there is more coming, so stay with me 🫢


✨ NAME ✨

SoGetPrimitiveCountAction β€” the class that counts the primitives in a scene. that's it. that's the whole job. it's giving census-taker but for your scene graph πŸ’…


✨ SYNOPSIS ✨

#include <Inventor/actions/SoGetPrimitiveCountAction.h>

Inherits SoAction.

🌸 Public Member Functions 🌸

virtual SoType getTypeId (void) const
SoGetPrimitiveCountAction (void)
SoGetPrimitiveCountAction (const SbViewportRegion &vp)
virtual ~SoGetPrimitiveCountAction (void)
int getTriangleCount (void) const
int getLineCount (void) const
int getPointCount (void) const
int getTextCount (void) const
int getImageCount (void) const
SbBool containsNoPrimitives (void)
SbBool containsNonTriangleShapes (void)
SbBool is3DTextCountedAsTriangles (void)
void setCount3DTextAsTriangles (const SbBool flag)
SbBool canApproximateCount (void)
void setCanApproximate (const SbBool flag)
void setDecimationValue (SoDecimationTypeElement::Type type, float
    percentage=1.0)
SoDecimationTypeElement::Type getDecimationType (void)
float getDecimationPercentage (void)
void addNumTriangles (const int num)
void addNumLines (const int num)
void addNumPoints (const int num)
void addNumText (const int num)
void addNumImage (const int num)
void incNumTriangles (void)
void incNumLines (void)
void incNumPoints (void)
void incNumText (void)
void incNumImage (void)

πŸ¦‹ Public Member Functions inherited from SoAction πŸ¦‹

like, she got all of these from her parent class, main character inheritance moment:

virtual ~SoAction (void)
virtual SbBool isOfType (SoType type) const
virtual void apply (SoNode *root)
virtual void apply (SoPath *path)
virtual void apply (const SoPathList &pathlist, SbBool obeysrules=FALSE)
void apply (SoAction *beingApplied)
virtual void invalidateState (void)
AppliedCode getWhatAppliedTo (void) const
SoNode * getNodeAppliedTo (void) const
SoPath * getPathAppliedTo (void) const
const SoPathList * getPathListAppliedTo (void) const
const SoPathList * getOriginalPathListAppliedTo (void) const
SbBool isLastPathListAppliedTo (void) const
PathCode getPathCode (int &numindices, const int *&indices)
void traverse (SoNode *const node)
SbBool hasTerminated (void) const
const SoPath * getCurPath (void)
SoState * getState (void) const
PathCode getCurPathCode (void) const
virtual 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 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) const
virtual 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 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 * state
SoActionMethodList * traversalMethods

✨ Detailed Description ✨

okay so the SoGetPrimitiveCountAction class counts the primitives in a scene. that's the vibe. that's the whole vibe πŸ’…

apply this action to a scene if you need to know the number of primitives present in a scene graph, or parts of a scene graph. yes bestie, parts too. we love a flexible queen.

now here's the big one, the mistake everybody makes, the classic, the "not me thinking…" moment:

one common mistake to make when using this action is to think that it traverses just the parts currently in view, like SoGLRenderAction does. (SoGLRenderAction culls away the scene graph parts outside the camera view volume and does not traverse those.) like most other action classes, SoGetPrimitiveCountAction actually traverses the complete scene graph, not just the parts currently in view.

so no, it does not care what your camera can see. it counts everything. it's giving thorough. it's giving completionist. it's giving "i read the whole syllabus" energy πŸ“šβœ¨

Since

  • Coin 1.0
  • TGS Inventor 2.5

✨ Constructor & Destructor Documentation ✨

🌸 SoGetPrimitiveCountAction::SoGetPrimitiveCountAction (void ) 🌸

constructor. hi hello, she's here 🫢

πŸ¦‹ SoGetPrimitiveCountAction::SoGetPrimitiveCountAction (const SbViewportRegion & vp) πŸ¦‹

constructor. supply the current viewport region to make SCREEN_SPACE counting correct. like, if you want screen-space numbers to actually be right, hand her the viewport, bestie, don't be shy πŸ’–

⭐ SoGetPrimitiveCountAction::~SoGetPrimitiveCountAction (void ) [virtual] ⭐

the destructor. bye bestie, thanks for the counts πŸ‘‹πŸ’œ


okay and there's still more to go, so don't go anywhere… πŸ’…

πŸ’– MEMBER FUNCTION DOCUMENTATION πŸ’–

bestie. the functions. there are SO many. grab a snack πŸ“, we're going in.


getTypeId() β€” [virtual]

SoType SoGetPrimitiveCountAction::getTypeId (void ) const [virtual]

Hands you the type identification for any object derived from a class that inherits SoAction. this is the whole runtime type-checking situation, and it's also how you do "downward" casting. no cap.

Implements SoAction.


getClassTypeId() β€” [static]

SoType SoGetPrimitiveCountAction::getClassTypeId (void ) [static]

a static lil method that returns the SoType object linked to objects of this class. that's it, that's the function. iconic behavior tbh ✨


addMethod() β€” [static]

void SoGetPrimitiveCountAction::addMethod (const SoType type, SoActionMethod method) [static]
heads up: this API member is considered internal to the library, because it is not likely to be of interest to the application programmer. so like… you can, but should you? πŸ™ˆ

enableElement() β€” [static]

void SoGetPrimitiveCountAction::enableElement (const SoType type, const int stackindex) [static]
same vibe check as above: this API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

getEnabledElements() β€” [protected], [virtual]

const SoEnabledElementsList & SoGetPrimitiveCountAction::getEnabledElements (void ) const [protected], [virtual]

returns the list of enabled elements. that's the whole job, she's simple like that πŸ’…

Reimplemented from SoAction.


getClassEnabledElements() β€” [static], [protected]

SoEnabledElementsList * SoGetPrimitiveCountAction::getClassEnabledElements (void ) [static], [protected]

returns the list of enabled elements for this class.

okay so the tea: the enabledElements and methods variables are protected in the original OIV API. that was… not a great idea, because exposed static class member variables are a major grievance when it comes to Win32 DLLs. 😭

this function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.


getClassActionMethods() β€” [static], [protected]

SoActionMethodList * SoGetPrimitiveCountAction::getClassActionMethods (void ) [static], [protected]

returns the list of action methods for this class.

and yes, same lore as the one right above: the enabledElements and methods variables are protected in the original OIV API, which 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 v2.1 API. 🫢


initClass() β€” [static]

void SoGetPrimitiveCountAction::initClass (void ) [static]

wakes up the runtime type system for this class, and sets up the enabled elements and the action method list. the whole glow-up, in one call ✨


getTriangleCount()

int SoGetPrimitiveCountAction::getTriangleCount (void ) const

returns the number of triangles in the graph. count 'em, bestie πŸ”Ί


getLineCount()

int SoGetPrimitiveCountAction::getLineCount (void ) const

returns the number of lines in the graph. πŸ“


getPointCount()

int SoGetPrimitiveCountAction::getPointCount (void ) const

returns the number of points in the graph.

okay IMPORTANT clarification: by "point" here, we mean an actual point primitive (for rendering), like the one in the SoPointSet shape node β€” not a polygon vertex. those are different things!! if you actually want to count the total number of polygon vertices in a scene (sub)graph, use the SoCallbackAction with the appropriate callback instead. iykyk πŸŽ€

getTextCount()

int SoGetPrimitiveCountAction::getTextCount (void ) const

returns the number of texts in the graph. πŸ“


getImageCount()

int SoGetPrimitiveCountAction::getImageCount (void ) const

returns the number of images in the graph. πŸ–ΌοΈ


containsNoPrimitives()

SbBool SoGetPrimitiveCountAction::containsNoPrimitives (void )

returns whether there are any primitives in the graph or not. yes/no, that's the whole vibe.


containsNonTriangleShapes()

SbBool SoGetPrimitiveCountAction::containsNonTriangleShapes (void )

returns whether there are non-triangular primitives in the graph. slay detection πŸ’€


is3DTextCountedAsTriangles()

SbBool SoGetPrimitiveCountAction::is3DTextCountedAsTriangles (void )

returns whether SoText3 nodes are counted as triangles or as text.

See also: is3DTextCountedAsTriangles()


setCount3DTextAsTriangles()

void SoGetPrimitiveCountAction::setCount3DTextAsTriangles (const SbBool flag)

sets whether SoText3 nodes get counted as the triangles of the fonts in the text strings, or as the text itself. the default is to count as triangles. periodt.

See also: is3DTextCountedAsTriangles()


canApproximateCount()

SbBool SoGetPrimitiveCountAction::canApproximateCount (void )

returns whether shapes are allowed to use an approximate value when counting primitives. that's faster than doing an accurate count. the default is to not approximate. (accuracy queen πŸ‘‘)

See also: setCanApproximate()


setCanApproximate()

void SoGetPrimitiveCountAction::setCanApproximate (const SbBool flag)

sets whether shapes can do an approximate count. go fast or go precise, your call bestie ⚑

See also: canApproximateCount()


setDecimationValue()

void SoGetPrimitiveCountAction::setDecimationValue (SoDecimationTypeElement::Type type, float percentage = 1.0)

sets up the decimation parameters for the traversal.

🚨 real talk: on-the-fly decimation is not supported in Coin yet, so this call will not have any effect until this feature has been implemented. it's giving "coming soon" energy. 😭

getDecimationType()

SoDecimationTypeElement::Type SoGetPrimitiveCountAction::getDecimationType (void )

returns the decimation type used during the traversal count.


getDecimationPercentage()

float SoGetPrimitiveCountAction::getDecimationPercentage (void )

returns the decimation percentage used during the traversal count.


addNumTriangles()

void SoGetPrimitiveCountAction::addNumTriangles (const int num)

adds num triangles to the total count. used by node instances in the scene graph during traversal.


addNumLines()

void SoGetPrimitiveCountAction::addNumLines (const int num)

adds num lines to the total count. used by node instances in the scene graph during traversal.


addNumPoints()

void SoGetPrimitiveCountAction::addNumPoints (const int num)

adds num points to the total count. used by node instances in the scene graph during traversal.


addNumText()

void SoGetPrimitiveCountAction::addNumText (const int num)

adds num texts to the total count. used by node instances in the scene graph during traversal.


addNumImage()

void SoGetPrimitiveCountAction::addNumImage (const int num)

adds num texture image maps to the total count. used by node instances in the scene graph during traversal.


incNumTriangles()

void SoGetPrimitiveCountAction::incNumTriangles (void )

adds a single triangle to the total count. used by node instances in the scene graph during traversal.


incNumLines()

void SoGetPrimitiveCountAction::incNumLines (void )

adds a single line to the total count. used by node instances in the scene graph during traversal.


incNumPoints()

void SoGetPrimitiveCountAction::incNumPoints (void )

adds a single point to the total count. used by node instances in the scene graph during traversal.


incNumText()

void SoGetPrimitiveCountAction::incNumText (void )

adds a single text to the total count. used by node instances in the scene graph during traversal.


incNumImage()

void SoGetPrimitiveCountAction::incNumImage (void )

adds a single texture image map to the total count. used by node instances in the scene graph during traversal.


beginTraversal() β€” [protected], [virtual]

void SoGetPrimitiveCountAction::beginTraversal (SoNode * node) [protected], [virtual]

this virtual method gets called from SoAction::apply(), and it is the entry point for the actual scene graph traversal. main character energy, honestly 🌟

you can override it to initialize the action at traversal start, for specific initializations in the action subclasses that inherit SoAction.

⚠️ the default method just calls traverse(). so any overridden implementation of this method must do that too (or call SoAction::beginTraversal()) to actually trigger the scene graph traversal. don't skip it, bestie, nothing will happen and you'll be so confused πŸ’€

Reimplemented from SoAction.


πŸ“ AUTHOR πŸ“

generated automatically by Doxygen for Coin from the source code. so technically the author is… a robot? we stan an automated king πŸ€–βœ¨


that's the whole page, you made it to the end, so proud of you fr fr 🫢

this was Coin Version 4.0.10, dated Thu Jun 25 2026 00:00:0 β€” and yes, that timestamp really does just get cut off like that at the end of SoGetPrimitiveCountAction(3). it's giving "the manpage generator ran out of characters" and honestly? iconic. slay. πŸ’…

πŸ“¦ where this page comes from