Class 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.

See Also:
  • Constructor Details

    • SoSimplifyAction

      public SoSimplifyAction(SoSimplifier _simplifier)
      Constructor. The algorithm used for simplifying is defined by the SoSimplifier class that is passed in the constructor.
  • Method Details

    • 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(String name)
      Sets the name used when creating Inline files for each simplified child.
    • getDirectRanges

      public 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(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 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 using SoWWWInline 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 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 using SoWWWInline 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.