Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoGetPrimitiveCountAction Class Reference

VSG extension Counts number of primitives in scene. More...

#include <Inventor/actions/SoGetPrimitiveCountAction.h>

+ Inheritance diagram for SoGetPrimitiveCountAction:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoGetPrimitiveCountAction ()
 Constructor.
 
virtual ~SoGetPrimitiveCountAction ()
 Destructor.
 
int32_t getTriangleCount () const
 Returns counted number of primitives (triangles).
 
int32_t getLineCount () const
 Returns counted number of primitives (lines).
 
int32_t getPointCount () const
 Returns counted number of primitives (points).
 
int32_t getTextCount () const
 Returns counted number of primitives (text).
 
int32_t getImageCount () const
 Returns counted number of primitives (images).
 
SbBool containsNoPrimitives ()
 Returns TRUE if scene contains no primitives of any kind.
 
SbBool containsNonTriangleShapes ()
 Returns TRUE if scene contains some primitives that are not triangles.
 
void setDecimationValue (SoDecimationTypeElement::Type type, float percentage=1.0)
 Sets decimation type and percentage.
 
SoDecimationTypeElement::Type getDecimationType ()
 Gets decimation type.
 
float getDecimationPercentage ()
 Gets decimation percentage.
 
void setCount3DTextAsTriangles (SbBool treatAsTris)
 SoText3 can be counted two ways: as a triangle-based shape or as a text-based shape.
 
SbBool is3DTextCountedAsTriangles ()
 Returns how SoText3 should be counted: as a triangle-based shape (TRUE) or as a text-based shape (FALSE).
 
void setCanApproximate (SbBool onOff)
 Some shapes may be able to guess an approximate number of triangles without actually counting.
 
SbBool canApproximateCount ()
 Returns whether shapes are allowed to approximate their count.
 
- Public Member Functions inherited from SoAction
virtual ~SoAction ()
 Destructor.
 
virtual void apply (SoNode *node)
 Initiates an action on the graph defined by a node.
 
virtual void apply (SoPath *path)
 Initiates an action on the graph defined by a path.
 
virtual void apply (const SoPathList &pathList, SbBool obeysRules=FALSE)
 Initiates an action on the graph defined by a list of paths.
 
virtual void clearApplyResult ()
 When applied, an action may reference nodes or create objects (e.g.
 
virtual void invalidateState ()
 Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.
 
void stopActionInBranch ()
 This function stops the action in the current Scene Graph branch.
 
SbBool getContinueActionInBranchFlag () const
 This function indicates if the action must stop in the current branch.
 
void resetContinueActionInBranchFlag ()
 This function resets the continue action flag.
 
void useAlternateRep (const SbBool enable)
 Tell the action to use alternate representations during traversal when available.
 
SbBool isUsingAlternateRep () const
 Returns TRUE if current action is using alternate representations.
 
void setSceneManager (SoSceneManager *mgr)
 Set the scene manager associated with this action (if any ).
 
SoSceneManagergetSceneManager () const
 Return the SoSceneManager associated with this action.
 
virtual void forwardTraversal (SoNode *node)
 Traverse a node that is not part of the current scenegraph.
 
virtual void forwardTraversal (SoPath *path)
 Traverse a path that is not part of the current scenegraph.
 
DistribMode getDistribMode () const
 Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).
 
AppliedCode getWhatAppliedTo () const
 Returns code indicating what action is being applied to.
 
SoNodegetNodeAppliedTo () const
 Returns the node the action is being applied to.
 
SoPathgetPathAppliedTo () const
 Returns the path the action is being applied to.
 
const SoPathListgetPathListAppliedTo () const
 Returns the path list the action is being applied to.
 
const SoPathListgetOriginalPathListAppliedTo () const
 Returns the original path list the action is being applied to.
 
SbBool isLastPathListAppliedTo () const
 Returns TRUE if the current list is the last one from the original.
 
PathCode getPathCode (int &numIndices, const int *&indices)
 Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.
 
PathCode getPathCodeMI (int &numIndices, const int *&indices, const int *&instanceIndices)
 Extender API: available to programmers who wish to extend the toolkit
 
void traverse (SoNode *node)
 Does traversal of a graph rooted by a node.
 
SbBool hasTerminated () const
 Returns TRUE if the traversal has reached a termination condition.
 
const SoPathgetCurPath ()
 Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.
 
SoStategetState () const
 Gets the state from the action.
 
virtual void setUpState ()
 Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.
 
void setPipeId (int id)
 Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
int getPipeId () const
 Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
bool isBeingApplied ()
 Returns TRUE if this action is currently being applied.
 
virtual bool preDelayedTraversal ()
 Method called by SoMultiPassManager before delayed pass traversals.
 
virtual void postDelayedTraversal ()
 Method called by SoMultiPassManager after delayed pass traversals.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void nullAction (SoAction *, SoNode *)
 Null action method that can be stored in lookup table when desired.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Additional Inherited Members

- Public Types inherited from SoAction
enum  DistribMode {
  LOCAL_ONLY ,
  CLUSTER_ONLY ,
  ALL
}
 This is used to define the way an action is distributed across a cluster. More...
 
enum  AppliedCode {
  NODE ,
  PATH ,
  PATH_LIST
}
 This enum is used to determine what the action is being applied to. More...
 
enum  PathCode {
  NO_PATH ,
  IN_PATH ,
  BELOW_PATH ,
  OFF_PATH
}
 This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More...
 

Detailed Description

VSG extension Counts number of primitives in scene.

This class counts the number of rendering primitives a scene would use to render. This can be used as an approximation of how long the scene would take to render. The primitives are divided into five categories: triangles, lines, points, text objects, and images.

After applying the action to a path or scene graph, the results can be obtained with the functions getTriangleCount(), getLineCount(), etc. The decimation value can be altered before applying, which is useful for finding the minimum and maximum number of primitives the scene requires (use LOWEST and HIGHEST).

3D Text, such as SoText3 can be counted as either text or triangles. The function setCount3DTextAsTriangles() will determine how these objects are counted.

Polygonal geometry nodes, for example SoIndexedFaceSet, are always counted as triangles even if the draw style (SoDrawStyle) is set to LINES or POINTS.

Some shapes, such as trimmed NURBS surfaces, can answer quicker if they are allowed to approximate how many primitives they will use instead of calculating an exact answer. If an exact answer is not required, passing TRUE to setCanApproximate() will speed the action.

Elements
Sets: SoDecimationTypeElement, SoDecimationPercentageElement

EXAMPLE

SEE ALSO

SoAction, SoLevelOfSimplification, SoOctreeOrdering, SoRenderList, SoValueOrdering

Definition at line 116 of file SoGetPrimitiveCountAction.h.

Constructor & Destructor Documentation

◆ SoGetPrimitiveCountAction()

SoGetPrimitiveCountAction::SoGetPrimitiveCountAction ( )

Constructor.

◆ ~SoGetPrimitiveCountAction()

virtual SoGetPrimitiveCountAction::~SoGetPrimitiveCountAction ( )
virtual

Destructor.

Member Function Documentation

◆ canApproximateCount()

SbBool SoGetPrimitiveCountAction::canApproximateCount ( )
inline

Returns whether shapes are allowed to approximate their count.

Definition at line 216 of file SoGetPrimitiveCountAction.h.

◆ containsNonTriangleShapes()

SbBool SoGetPrimitiveCountAction::containsNonTriangleShapes ( )

Returns TRUE if scene contains some primitives that are not triangles.

◆ containsNoPrimitives()

SbBool SoGetPrimitiveCountAction::containsNoPrimitives ( )

Returns TRUE if scene contains no primitives of any kind.

◆ getClassTypeId()

static SoType SoGetPrimitiveCountAction::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getDecimationPercentage()

float SoGetPrimitiveCountAction::getDecimationPercentage ( )
inline

Gets decimation percentage.

Definition at line 190 of file SoGetPrimitiveCountAction.h.

◆ getDecimationType()

SoDecimationTypeElement::Type SoGetPrimitiveCountAction::getDecimationType ( )
inline

Gets decimation type.

Definition at line 186 of file SoGetPrimitiveCountAction.h.

◆ getImageCount()

int32_t SoGetPrimitiveCountAction::getImageCount ( ) const
inline

Returns counted number of primitives (images).

Definition at line 150 of file SoGetPrimitiveCountAction.h.

◆ getLineCount()

int32_t SoGetPrimitiveCountAction::getLineCount ( ) const
inline

Returns counted number of primitives (lines).

Definition at line 138 of file SoGetPrimitiveCountAction.h.

◆ getPointCount()

int32_t SoGetPrimitiveCountAction::getPointCount ( ) const
inline

Returns counted number of primitives (points).

Definition at line 142 of file SoGetPrimitiveCountAction.h.

◆ getTextCount()

int32_t SoGetPrimitiveCountAction::getTextCount ( ) const
inline

Returns counted number of primitives (text).

Definition at line 146 of file SoGetPrimitiveCountAction.h.

◆ getTriangleCount()

int32_t SoGetPrimitiveCountAction::getTriangleCount ( ) const
inline

Returns counted number of primitives (triangles).

Definition at line 134 of file SoGetPrimitiveCountAction.h.

◆ getTypeId()

virtual SoType SoGetPrimitiveCountAction::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Implements SoTypedObject.

◆ is3DTextCountedAsTriangles()

SbBool SoGetPrimitiveCountAction::is3DTextCountedAsTriangles ( )
inline

Returns how SoText3 should be counted: as a triangle-based shape (TRUE) or as a text-based shape (FALSE).

Definition at line 203 of file SoGetPrimitiveCountAction.h.

◆ setCanApproximate()

void SoGetPrimitiveCountAction::setCanApproximate ( SbBool  onOff)
inline

Some shapes may be able to guess an approximate number of triangles without actually counting.

In the interests of speed, and depending on how the results are used, a flag is available to allow shapes to approximate their count. The default is FALSE.

Definition at line 211 of file SoGetPrimitiveCountAction.h.

◆ setCount3DTextAsTriangles()

void SoGetPrimitiveCountAction::setCount3DTextAsTriangles ( SbBool  treatAsTris)
inline

SoText3 can be counted two ways: as a triangle-based shape or as a text-based shape.

This routine specifies how SoText3 should be counted. The default is TRUE (SoText3 adds to the triangle count, not the text count).

Definition at line 197 of file SoGetPrimitiveCountAction.h.

◆ setDecimationValue()

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

Sets decimation type and percentage.

Percentage should be a number between 0.0 and 1.0 (1.0 is full complexity).

Type is one of:

SoDecimationTypeElement::LOWEST
Lowest complexity possible for scene.

SoDecimationTypeElement::HIGHEST
Highest complexity possible for scene.

SoDecimationTypeElement::AUTOMATIC
Scene uses decimation percentage; LODs calculate range value and then adjust them with percentage.

SoDecimationTypeElement::PERCENTAGE
Scene uses decimation percentage; LODs use child based solely on decimation without looking at camera position.


The documentation for this class was generated from the following file: