public class SoGetPrimitiveCountAction extends SoAction
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
, SoVRMLText
and SoAsciiText
, 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 = new SoGetPrimitiveCountAction(); gpca.apply( root ); int numTris = gpca.getTriangleCount();
See also:
SoAction
, SoLevelOfSimplification
, SoOctreeOrdering
, SoRenderList
, SoValueOrdering
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
Inventor.ConstructorCommand
ALL, BELOW_PATH, CLUSTER_ONLY, IN_PATH, LOCAL_ONLY, NO_PATH, NODE, OFF_PATH, PATH, PATH_LIST
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoGetPrimitiveCountAction()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNumImage(int num) |
void |
addNumLines(int num) |
void |
addNumPoints(int num) |
void |
addNumText(int num) |
void |
addNumTriangles(int num) |
boolean |
canApproximateCount()
Returns whether shapes are allowed to approximate their count.
|
boolean |
containsNonTriangleShapes()
Returns true if scene contains some primitives that are not triangles.
|
boolean |
containsNoPrimitives()
Returns true if scene contains no primitives of any kind.
|
static void |
enableElement(java.lang.Class<? extends Inventor> t,
int stkIndex) |
float |
getDecimationPercentage()
Gets decimation percentage.
|
SoDecimationTypeElement.Types |
getDecimationType()
Gets decimation type.
|
int |
getImageCount()
Returns counted number of primitives (images).
|
int |
getLineCount()
Returns counted number of primitives (lines).
|
int |
getPointCount()
Returns counted number of primitives (points).
|
int |
getTextCount()
Returns counted number of primitives (text).
|
int |
getTriangleCount()
Returns counted number of primitives (triangles).
|
void |
incNumImage() |
void |
incNumLines() |
void |
incNumPoints() |
void |
incNumText() |
void |
incNumTriangles() |
boolean |
is3DTextCountedAsTriangles()
Returns how
SoText3 should be counted: as a triangle-based shape (true) or as a text-based shape (false). |
void |
setCanApproximate(boolean onOff)
Some shapes may be able to guess an approximate number of triangles without actually counting.
|
void |
setCount3DTextAsTriangles(boolean treatAsTris)
SoText3 can be counted two ways: as a triangle-based shape or as a text-based shape. |
void |
setDecimationValue(SoDecimationTypeElement.Types type)
Calls setDecimationValue(type, (float)1.0).
|
void |
setDecimationValue(SoDecimationTypeElement.Types type,
float percentage)
Sets decimation type and percentage.
|
apply, apply, clearApplyResult, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public void setDecimationValue(SoDecimationTypeElement.Types type)
public void incNumText()
public void incNumImage()
public int getImageCount()
public boolean containsNonTriangleShapes()
public void incNumPoints()
public boolean containsNoPrimitives()
public int getTriangleCount()
public boolean canApproximateCount()
public int getTextCount()
public int getPointCount()
public int getLineCount()
public boolean is3DTextCountedAsTriangles()
SoText3
should be counted: as a triangle-based shape (true) or as a text-based shape (false).public void addNumPoints(int num)
public void setCount3DTextAsTriangles(boolean treatAsTris)
public void addNumLines(int num)
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
public void addNumTriangles(int num)
public void setCanApproximate(boolean onOff)
public void incNumTriangles()
public void setDecimationValue(SoDecimationTypeElement.Types type, float percentage)
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.
public void incNumLines()
public SoDecimationTypeElement.Types getDecimationType()
public void addNumText(int num)
public float getDecimationPercentage()
public void addNumImage(int num)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com