Class SoHaloHighlightRenderAction


  • public class SoHaloHighlightRenderAction
    extends SoHighlightRenderAction
    A halo highlight style. SoHaloHighlightRenderAction is a render action which renders the specified scene graph, then renders a "halo" highlight around each selected object. See the images below for examples of this highlight technique. Halo highlighting works with all kinds of shapes including VolumeViz and MeshVizXLM. However, if a selected object does not write to the depth buffer for any reason, it will not be highlighted.

    Selected objects are specified by the first selection node (SoSelection or SoExtSelection) node in the scene to which this action is applied. If there is no selection node in the scene graph, then no objects will be highlighted.

    The application must explicitly tell Open Inventor to use a highlight render action in place of the default SoGLRenderAction in the SoSceneManager class using the setGLRenderAction() method. The viewer classes provide a convenience setGLRenderAction() method that calls SoSceneManager (see e.g. SoWinRenderArea).

    For convenience, the viewer classes also provide the redrawOnSelectionChange() method. This method attaches a sensor to the specified selection node and automatically schedules a redraw if the set of selected objects is modified.

    Here is an example of an SoAlgebraicCone highlighted with an SoHaloHighlightRenderAction:

    Here are parameters that can be adjusted:

    NOTES

    • The rendering of the halo uses the depth buffer of the selected shapes as its boundary.
    • Increasing the halo width value decreases performance.
    • When multiple objects are selected, they are highlighted as one unique shape, i.e. the halo is done on the union of their depth buffer. This is illustrated on the following image:
        2 selected objects are highlighted as one

      EXAMPLE

      Here is an example of how a halo highlight can be specified for a particular selection node and render area:

       // Viewer
       ViewerExaminer viewer = new ViewerExaminer();
       
       // Set the highlight render action
       final RenderArea area = viewer.getRenderArea();
       area.setGLRenderAction( new SoHaloHighlightRenderAction() );
       
       // Scene graph
       SoSelection selectionNode = new SoSelection();
       
       // Request automatic redraw when selection changes
       selectionNode.addChangeCallback(new SoSelectionClassCB()
       {
         public void invoke(SoSelection s)
         {
           area.scheduleRedraw();
         }
       });
       . . .
       viewer.setSceneGraph( selectionNode );

    See Also:
    SoLineHighlightRenderAction, SoColorHighlightRenderAction, SoBoxHighlightRenderAction, SoHighlightRenderAction, SoGLRenderAction, SoSelection, SoWinRenderArea
    • Constructor Detail

      • SoHaloHighlightRenderAction

        public SoHaloHighlightRenderAction()
      • SoHaloHighlightRenderAction

        public SoHaloHighlightRenderAction​(SbViewportRegion viewportRegion)
    • Method Detail

      • setHaloColor

        public void setHaloColor​(SbColor color)
        Defines the color of the highlight. Default is red (1,0,0).

        Here are examples of halo highlighting with different colors:

          Red Green Blue
      • setHaloSmoothFactor

        public void setHaloSmoothFactor​(float smoothFactor)
        Defines the amount of alpha attenuation of the halo contour. Default is 0. The value will be clamped between 0 and 1.

        The following images shows an example of halo highlighting with different values for the smooth factor:

          smoothFactor = 0 smoothFactor = 0.33 smoothFactor = 0.66 smoothFactor = 1
      • setHaloAlwaysVisible

        public void setHaloAlwaysVisible​(boolean alwaysVisible)
        Defines whether or not the halo can be seen through objects that are placed in front of selected shapes. Default is false.

        The following images shows an example of halo highlighting with alwaysVisible set to false and true:

          alwaysVisible = false alwaysVisible = true
      • setHaloWidth

        public void setHaloWidth​(int width)
        Defines the width of the halo in pixels. Default is 3.

        Only values greater or equal to 1 are accepted. If a value of 0 or lower is given, the effective value will be clamped to 1.

        The following images shows an example of halo highlighting with different values for the halo width:

          width = 1 width = 3 width = 7 width = 15
      • enableElement

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