Class SoGlobalSimplifyAction
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.actions.SoAction
-
- com.openinventor.inventor.actions.SoSimplifyAction
-
- com.openinventor.inventor.actions.SoGlobalSimplifyAction
-
public class SoGlobalSimplifyAction extends SoSimplifyAction
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.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 thesetCatchAllShapesFlag()
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 theSoGlobalSimplifyAction
.Typically you will pass an instance of
SoDecimator
to the constructor. Please seeSoDecimator
for info about which geometry objects can be simplified.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoGlobalSimplifyAction.Strategies
Strategy.-
Nested 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 Constructor Description SoGlobalSimplifyAction(SoSimplifier _simplifier)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addShapeHintsNode(boolean a)
Sets whether a shape hints node is added.boolean
areAllShapesCatched()
Gets the flag that specifies whether simple shapes are simplified.boolean
areNormalGenerated()
Gets the normal generation flag.static void
enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
void
generateNormals(boolean g)
Sets the normal generation flag.SoGlobalSimplifyAction.Strategies
getSimplificationStrategy()
Gets the strategy used to determine how to group triangles into the simplified shapes.SoSeparator
getSimplifiedSceneGraph()
This returns the new scene graph which contains the simplified result.boolean
isShapeHintAdded()
Gets whether a shape hints node will be added.void
setCatchAllShapesFlag(boolean c)
Sets the flag that specifies whether simple shapes are simplified.void
setSimplificationStrategy(SoGlobalSimplifyAction.Strategies st)
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 Detail
-
SoGlobalSimplifyAction
public SoGlobalSimplifyAction(SoSimplifier _simplifier)
Constructor. The algorithm used for simplifying is defined by theSoSimplifier
class that is passed in the constructor.
-
-
Method Detail
-
isShapeHintAdded
public boolean isShapeHintAdded()
Gets whether a shape hints node will be added.
-
setSimplificationStrategy
public void setSimplificationStrategy(SoGlobalSimplifyAction.Strategies st)
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
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
-
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
public SoSeparator getSimplifiedSceneGraph()
This returns the new scene graph which contains the simplified result.
-
getSimplificationStrategy
public SoGlobalSimplifyAction.Strategies 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.
-
-