Class SceneInteractor

  • All Implemented Interfaces:
    Direct Known Subclasses:
    SceneExaminer, SceneOrbiter

    public class SceneInteractor
    extends SoSeparator
    Tool class for easily building a basic OpenInventor application without using existing viewer classes.

    The SceneInteractor is a simple extension of the SoSeparator node that allows handling of Open Inventor events. This class should be overridden as it provides only empty event handlers.

    This node is intended to be used as the root of a scene graph. The SceneInteractor is a custom SoSeparator whose children are:

    • an SoEventCallback node that handles keyboard, mouse and touch events
    • a camera (switch between perspective and orthographic camera)
    • a headlight
    • the application's scene graph, which should be the last child.
    The SceneInteractor uses an instance of SoCameraInteractor in order to manipulate the camera in response to OpenInventor events.

    Class diagram of the SceneInteractor showing the relationship between the SoEventCallback, the SoCamera, the SoDirectionalLight (used as headlight) and the SoCameraInteractor.

    Class diagram

    Detail of the scene graph rooted by a SceneInteractor:

    Detail of the
 scene graph


    • A basic version of SceneInteractor is a supported part of the OpenInventor API, the prebuilt jar is located in the usual folder $OIVJHOME/jre/lib/ext.
    • The basic version of SceneInteractor is also provided as source code in the sources folder to allow applications to customize and build their own interactive tool class. See $OIVJHOME/sources/com/openinventor/inventor/viewercomponents.
    • Constructor Detail

      • SceneInteractor

        public SceneInteractor()
    • Method Detail

      • getCameraInteractor

        public SoCameraInteractor getCameraInteractor()
        the current camera interactor
      • getCamera

        public SoCamera getCamera()
        Returns the current camera.
        the current camera
      • adjustClippingPlanes

        public void adjustClippingPlanes​(SbViewportRegion vpRegion)
        Adjust near and far clipping planes to minimize clipping of objects in the scene. This adjustment, based on the bounding box of the scene, ensures that shapes will not be clipped and also that depth buffer precision is maximized. This method should be called before each render traversal.
      • viewAll

        public void viewAll​(SbViewportRegion vpRegion)
        Set the camera to view all the scene.
      • viewAxis

        public void viewAxis​(SbVec3f direction,
                             SbVec3f up)
        Moves the camera to be aligned with the given direction vector while keeping the "up" direction of the camera parallel to the specified up vector.
        direction - the new view direction vector
        up - the new "up" direction
      • enableHeadlight

        public void enableHeadlight​(boolean enabled)
        Enable or disable headlight.
      • isHeadlightEnabled

        public boolean isHeadlightEnabled()
        Return if headlight is enabled.