Class SoGlobalSimplifyAction
This class traverses the scene graph and collects all the triangles in a single list. This list is then simplified and the result is stored in a new scene graph.
The SoGlobalSimplifyAction
provides two simplification strategies:
- SIMPLIFY_GLOBALLY: all the triangles found in the scene graph are collected in a single object. Then this object is simplified.
- SIMPLIFY_BY_SUBGROUP: triangles are collected until a material change or a separator is found.
The default strategy is SIMPLIFY_BY_SUBGROUP.
NOTE: Colors and normal vectors in the existing shapes are not preserved!
Calling generateNormals(true), which is the default, tells Open Inventor to compute per-vertex normal during this action. When disabled (calling generateNormals(false)), objects may appear faceted instead of appearing smooth.
If generateNormals is false, it may be useful to call addShapeHints(true). This tells Open Inventor to add an SoShapeHints
node to the result scene graph that will cause normals to be computed during the next render traversal.
By default the SoGlobalSimplifyAction
collects all the triangles even if they are part of a simple shape (cube, cone, sphere, text3...). Setting the setCatchAllShapesFlag()
flag to false tells the action to collect triangles only if they belong to a complex shape.
The getSimplifiedSceneGraph()
method returns the root of the new scene graph after applying the SoGlobalSimplifyAction
.
Typically you will pass an instance of SoDecimator
to the constructor. Please see SoDecimator
for info about which geometry objects can be simplified.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.openinventor.inventor.actions.SoAction
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addShapeHintsNode
(boolean a) Sets whether a shape hints node is added.boolean
Gets the flag that specifies whether simple shapes are simplified.boolean
Gets the normal generation flag.static void
enableElement
(Class<? extends Inventor> t, int stkIndex) void
generateNormals
(boolean g) Sets the normal generation flag.Gets the strategy used to determine how to group triangles into the simplified shapes.This returns the new scene graph which contains the simplified result.boolean
Gets whether a shape hints node will be added.void
setCatchAllShapesFlag
(boolean c) Sets the flag that specifies whether simple shapes are simplified.void
Sets the strategy used to determine how to group triangles into the simplified shapes.Methods inherited from class com.openinventor.inventor.actions.SoSimplifyAction
getDirectRanges, getDirectSimplificationLevels, getMinTriangles, getNumRanges, getNumSimplificationLevels, getRanges, getSimplificationLevels, getSizeFactor, getUrlName, isInlineLOD, isRenderCulling, isVerbose, setInlineLOD, setMinTriangles, setRanges, setRenderCulling, setSimplificationLevels, setSizeFactor, setUrlName, setVerbosity
Methods inherited from class com.openinventor.inventor.actions.SoAction
apply, apply, clearApplyResult, forwardTraversal, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getDistribMode, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoGlobalSimplifyAction
Constructor. The algorithm used for simplifying is defined by theSoSimplifier
class that is passed in the constructor.
-
-
Method Details
-
isShapeHintAdded
public boolean isShapeHintAdded()Gets whether a shape hints node will be added. -
setSimplificationStrategy
Sets the strategy used to determine how to group triangles into the simplified shapes. The choices are SIMPLIFY_GLOBALLY and SIMPLIFY_BY_SUBGROUP. Default is SIMPLIFY_BY_GROUP. -
areAllShapesCatched
public boolean areAllShapesCatched()Gets the flag that specifies whether simple shapes are simplified. -
setCatchAllShapesFlag
public void setCatchAllShapesFlag(boolean c) -
enableElement
-
addShapeHintsNode
public void addShapeHintsNode(boolean a) Sets whether a shape hints node is added. If true, a shapeHints node is added to force smooth normals if they were not generated, and to turn on two-sided lighting. Default is false. -
getSimplifiedSceneGraph
This returns the new scene graph which contains the simplified result. -
getSimplificationStrategy
Gets the strategy used to determine how to group triangles into the simplified shapes. -
areNormalGenerated
public boolean areNormalGenerated()Gets the normal generation flag. If true, per-vertex normals are calculated while simplifying. -
generateNormals
public void generateNormals(boolean g) Sets the normal generation flag. If true, per-vertex normals are calculated while simplifying. Default value is true.
-