Class SoSimplifyAction
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.actions.SoAction
-
- com.openinventor.inventor.actions.SoSimplifyAction
-
- Direct Known Subclasses:
SoGlobalSimplifyAction
,SoReorganizeAction
,SoShapeSimplifyAction
public class SoSimplifyAction extends SoAction
Abstract base class for simplifying scene graphs. This class is the base class of the simplify actions that produce versions of a scene graph with fewer triangles. The simplify actions can generate either several simplified levels of the original geometry, grouped by a LevelOfSimplification node, or just one reduced level of detail. If a single level is computed, the action creates a single IndexedTriangleFaceSet.Each simplified sub-levels can be stored in regular separators or in WWWInline nodes. In this case, the urlName defines the full url to use for each WWWInline. For instance if urlName = "dir/file", the action will generate "dir/file_1.wrl","dir/file_2.wrl", and so on. When a simplify action generates Level of Simplification nodes, the range field of each Level of Simplification node can be given globally in the range field of the simplify action. If the simplify action range field is not set, the simplify action computes it automatically for each LevelOfSimplification node. In this case, the sizeFactor field can be used to customize the range computation.
A minimum number of triangles can be set to stop the simplification when the object becomes too small. Specifying 0.0 for the last level inserts an empty node in the scene graph. This allows you to avoid rendering an object that is too small or too far from the viewer.
Available simplification actions are:
SoGlobalSimplifyAction
Traverses the scene graph and collects all the triangles into a single shape which is then simplified.SoShapeSimplifyAction
Traverses the scene graph and simplifies each shape independently.SoReorganizeAction
Reorganizes the scene graph by grouping shapes with common properties, then combines those shapes in a single shape and runs the simplifier on it.
-
-
Nested Class Summary
-
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 SoSimplifyAction(SoSimplifier _simplifier)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
java.nio.FloatBuffer
getDirectRanges()
Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.java.nio.FloatBuffer
getDirectSimplificationLevels()
Gets percentages to produce at each level of detail.int
getMinTriangles()
Gets the minimum number of triangles for a simplified child.int
getNumRanges()
Gets the number of ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.int
getNumSimplificationLevels()
Gets number of levels of detail to produce.float[]
getRanges()
Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.float[]
getSimplificationLevels()
Gets percentages to produce at each level of detail.float
getSizeFactor()
Gets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.java.lang.String
getUrlName()
Gets the name used when creating Inline files for each simplified child.boolean
isInlineLOD()
Gets inlineLOD flag.int
isRenderCulling()
Gets render culling flag.boolean
isVerbose()
Gets verbosity flag.void
setInlineLOD(boolean i)
Sets inlineLOD flag.void
setMinTriangles(int mt)
Sets the minimum number of triangles for a simplified child; if a given percentage would create a simplified version that went below this minimum, no simplified chld is produced for this level.void
setRanges(float[] newRanges)
Sets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.void
setRenderCulling(boolean r)
Sets render culling flag.void
setSimplificationLevels(float[] levels)
Sets number of levels of detail to produce and what percentage to produce at each level.void
setSizeFactor(float size)
Sets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.void
setUrlName(java.lang.String name)
Sets the name used when creating Inline files for each simplified child.void
setVerbosity(boolean v)
Sets verbosity flag.-
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
-
SoSimplifyAction
public SoSimplifyAction(SoSimplifier _simplifier)
Constructor. The algorithm used for simplifying is defined by theSoSimplifier
class that is passed in the constructor.
-
-
Method Detail
-
setRanges
public void setRanges(float[] newRanges)
Sets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display. This is optional; if not given, the size factor will be used to generate range values.
-
setUrlName
public void setUrlName(java.lang.String name)
Sets the name used when creating Inline files for each simplified child.
-
getDirectRanges
public java.nio.FloatBuffer getDirectRanges()
Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
-
enableElement
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
-
setSimplificationLevels
public void setSimplificationLevels(float[] levels)
Sets number of levels of detail to produce and what percentage to produce at each level. An example array would be [1.0, 0.3, 0.1], which would generate a LevelOfSimplification node with the original geometry and then two simplified children, one with 30% of the triangles and the other with 10% of the triangles in the original.
-
getDirectSimplificationLevels
public java.nio.FloatBuffer getDirectSimplificationLevels()
Gets percentages to produce at each level of detail.
-
getNumSimplificationLevels
public int getNumSimplificationLevels()
Gets number of levels of detail to produce.
-
getSimplificationLevels
public float[] getSimplificationLevels()
Gets percentages to produce at each level of detail.
-
isVerbose
public boolean isVerbose()
Gets verbosity flag. If true, the simplify action prints out messages at each stage of the simplification.
-
setInlineLOD
public void setInlineLOD(boolean i)
Sets inlineLOD flag. If true, each simplified child is written into a separate file usingSoWWWInline
nodes.
-
setMinTriangles
public void setMinTriangles(int mt)
Sets the minimum number of triangles for a simplified child; if a given percentage would create a simplified version that went below this minimum, no simplified chld is produced for this level.
-
getUrlName
public java.lang.String getUrlName()
Gets the name used when creating Inline files for each simplified child.
-
setVerbosity
public void setVerbosity(boolean v)
Sets verbosity flag. If true, the simplify action prints out messages at each stage of the simplification.
-
isInlineLOD
public boolean isInlineLOD()
Gets inlineLOD flag. If true, each simplified child is written into a separate file usingSoWWWInline
nodes.
-
getSizeFactor
public float getSizeFactor()
Gets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.
-
getNumRanges
public int getNumRanges()
Gets the number of ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
-
isRenderCulling
public int isRenderCulling()
Gets render culling flag. If true, the "renderCulling" field will be set to ON for the Separators that hold each simplified level.
-
getRanges
public float[] getRanges()
Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
-
getMinTriangles
public int getMinTriangles()
Gets the minimum number of triangles for a simplified child.
-
setSizeFactor
public void setSizeFactor(float size)
Sets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.
-
setRenderCulling
public void setRenderCulling(boolean r)
Sets render culling flag. If true, the "renderCulling" field will be set to ON for the Separators that hold each simplified level.
-
-