Class SoSplitGeometryAction


  • public class SoSplitGeometryAction
    extends SoAction
    Split large geometry into smaller objects to improve culling for multi-pipe rendering. View frustum culling, for example using the SoOctreeOrdering node, is an important optimization, especially for multi-pipe rendering. However, a large object implemented as a single geometry node cannot be effectively culled. For each pipe where the object is partially visible, the entire object must be rendered.

    This action splits a large object into multiple geometry nodes, without changing the appearance of the object. Culling can then applied to the new nodes individually.

    The scene does not need to be subdivided into a large number of parts. Usually, 5 by 5 is enough to reasonably divide work between the threads. The new objects use the same vertex coordinates (and normals, materials,... if specified) as the original geometry. No triangles are added, removed, or split. A small amount of additional memory is required for the coordinate indices in the new objects.

    Note: Currently this action applies only to SoIndexedFaceSet and SoIndexedTriangleStripSet nodes. The new object is the same type of node as the original.

    Texture Mapping: If the original geometry has explicit texture coordinates, the result will be correct. If texture coordinates are computed by Open Inventor, the texture will be applied separately to each new object.

    SoOctreeOrdering, SoIndexedFaceSet, SoIndexedTriangleStripSet, SoShapeHints

    • Constructor Detail

      • SoSplitGeometryAction

        public SoSplitGeometryAction​(int divAlongX,
                                     int divAlongY)
        Constructor for splitting geometry along 2 dimensions. By default, the first and second values specify the number of divisions to be used along the object's x and y bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 2D bounding box these division values are applied to.
      • SoSplitGeometryAction

        public SoSplitGeometryAction​(int divAlongX,
                                     int divAlongY,
                                     int divAlongZ)
        Constructor for splitting geometry along 3 dimensions. By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to. NOTE: Do not use this constructor to split a scene containing flat objects.
    • Method Detail

      • getNumDivisions

        public int[] getNumDivisions()
        Returns the current division values to split an object in 3D.
      • isDistinguishSplitParts

        public boolean isDistinguishSplitParts()
        Returns true if distinguish split parts is enabled.
      • setDistinguishSplitParts

        public void setDistinguishSplitParts​(boolean enable)
        Calling this method before applying the action allows you to see how the action has split the objects. Each new SoIndexedShape is assigned a unique material. Default is false.
      • setNumDivisions

        public void setNumDivisions​(int numX,
                                    int numY,
                                    int numZ)
        Specifies the number of divisions for splitting an object in 3D. By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to.
      • setNumDivisions

        public void setNumDivisions​(int numX,
                                    int numY)
        Specifies the number of divisions for splitting an object in 2D. By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to.
      • isTraverseAllSoSwitchChildren

        public int isTraverseAllSoSwitchChildren()
        Returns true if traverse all SoSwitch children is enabled.
      • setTraverseAllSoSwitchChildren

        public void setTraverseAllSoSwitchChildren​(boolean enable)
        By default the action will only traverse the active child of SoSwitch nodes. A call to this method tells the action to traverse all children. Default is false.
      • setMaximumDivisionWarning

        public void setMaximumDivisionWarning​(boolean enable)
        There is a maximum number of division to divide an object because this object is composed by some primitives (triangles) that cannot be split without changing the geometry. If one of the arguments specified in the constructor is greater than this maximum division value, then the action will naturally split the object with the maximum division it is possible to. A call to this function enable Inventor warnings to know if you've reached this maximum value. Turning it on will slow the action traversal because, to know if the division value is good or not, the length average of every primitives is calculated. Inventor warnings are Off by default.
      • enableElement

        public static void enableElement​(java.lang.Class<? extends Inventor> t,
                                         int stkIndex)
      • isMaintainVertexOrdering

        public boolean isMaintainVertexOrdering()
        Returns true if the option to maintain initial vertex ordering is on.
      • setKeepOriginalGeometry

        public void setKeepOriginalGeometry​(boolean enable)
        By default, the action modifies the scene graph by replacing the original node it has split with a new separator containing all the new nodes. The behavior can be changed by a call to this method. Instead of replacing the node with a separator, the original node is replaced with an SoSwitch node containing the original node and the separator containing all the new nodes. Each new SoSwitch node added in the scene graph is named "switchX" where X is the Xth object split. For instance, the first object split by the action will have a corresponding switch node named "switch0". Default is false.
      • getNumObjFound

        public int getNumObjFound()
        Returns how many objects the action has split. This method must be called after the action has been applied.
      • isKeepOriginalGeometry

        public boolean isKeepOriginalGeometry()
        Returns true if keep original geometry is enabled.
      • isSmartSplitting

        public boolean isSmartSplitting()
        Returns true if smart splitting is enabled.
      • setSmartSplitting

        public void setSmartSplitting​(boolean enable)
        If this option is set before the action is applied, objects will be split by dividing the greatest bounding box side into the largest number of divisions, the next largest side by the next largest number of divisions, and so on. Otherwise the action will divide objects by using the first division value given in the constructor for the x side of the bounding box, the second for y, and so on. Default is false.