Counts number of primitives in scene. More...
#include <Inventor/actions/SoGetPrimitiveCountAction.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoGetPrimitiveCountAction () | |
virtual | ~SoGetPrimitiveCountAction () |
int32_t | getTriangleCount () const |
int32_t | getLineCount () const |
int32_t | getPointCount () const |
int32_t | getTextCount () const |
int32_t | getImageCount () const |
SbBool | containsNoPrimitives () |
SbBool | containsNonTriangleShapes () |
void | setDecimationValue (SoDecimationTypeElement::Type type, float percentage=1.0) |
SoDecimationTypeElement::Type | getDecimationType () |
float | getDecimationPercentage () |
void | setCount3DTextAsTriangles (SbBool treatAsTris) |
SbBool | is3DTextCountedAsTriangles () |
void | setCanApproximate (SbBool onOff) |
SbBool | canApproximateCount () |
Static Public Member Functions | |
static SoType | getClassTypeId () |
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
// Count triangles in scene graph SoGetPrimitiveCountAction gpca; gpca.apply( root ); int numTris = gpca.getTriangleCount();
SoAction, SoLevelOfSimplification, SoOctreeOrdering, SoRenderList, SoValueOrdering
SoGetPrimitiveCountAction::SoGetPrimitiveCountAction | ( | ) |
Constructor.
virtual SoGetPrimitiveCountAction::~SoGetPrimitiveCountAction | ( | ) | [virtual] |
Destructor.
SbBool SoGetPrimitiveCountAction::canApproximateCount | ( | ) | [inline] |
Returns whether shapes are allowed to approximate their count.
SbBool SoGetPrimitiveCountAction::containsNonTriangleShapes | ( | ) |
Returns TRUE if scene contains some primitives that are not triangles.
SbBool SoGetPrimitiveCountAction::containsNoPrimitives | ( | ) |
Returns TRUE if scene contains no primitives of any kind.
static SoType SoGetPrimitiveCountAction::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoAction.
float SoGetPrimitiveCountAction::getDecimationPercentage | ( | ) | [inline] |
Gets decimation percentage.
SoDecimationTypeElement::Type SoGetPrimitiveCountAction::getDecimationType | ( | ) | [inline] |
Gets decimation type.
int32_t SoGetPrimitiveCountAction::getImageCount | ( | ) | const [inline] |
Returns counted number of primitives (images).
int32_t SoGetPrimitiveCountAction::getLineCount | ( | ) | const [inline] |
Returns counted number of primitives (lines).
int32_t SoGetPrimitiveCountAction::getPointCount | ( | ) | const [inline] |
Returns counted number of primitives (points).
int32_t SoGetPrimitiveCountAction::getTextCount | ( | ) | const [inline] |
Returns counted number of primitives (text).
int32_t SoGetPrimitiveCountAction::getTriangleCount | ( | ) | const [inline] |
Returns counted number of primitives (triangles).
virtual SoType SoGetPrimitiveCountAction::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
SbBool SoGetPrimitiveCountAction::is3DTextCountedAsTriangles | ( | ) | [inline] |
Returns how SoText3 should be counted: as a triangle-based shape (TRUE) or as a text-based shape (FALSE).
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.
void SoGetPrimitiveCountAction::setCount3DTextAsTriangles | ( | SbBool | treatAsTris | ) | [inline] |
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.