Class 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 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:
    SoAction, SoLevelOfSimplification, SoShapeSimplifyAction, SoSimplifyAction
    • Constructor Detail

      • SoGlobalSimplifyAction

        public SoGlobalSimplifyAction​(SoSimplifier _simplifier)
        Constructor. The algorithm used for simplifying is defined by the SoSimplifier 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)
        Sets the flag that specifies whether simple shapes are simplified. If true, simple shapes such as SoSphere, SoCone, etc, are faceted and simplified also. If false, then they are ignored. Default is true.
      • 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.