Class SceneInteractor
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SceneExaminer
,SceneOrbiter
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.
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.
Detail of the scene graph rooted by a SceneInteractor:
Notes:
- 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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoSeparator
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.nodes.SoSeparator
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
Fields inherited from class com.openinventor.inventor.nodes.SoGroup
boundingBoxIgnoring
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjustClippingPlanes
(SbViewportRegion vpRegion) Adjust near and far clipping planes to minimize clipping of objects in the scene.void
enableHeadlight
(boolean enabled) Enable or disable headlight.Returns the current camera.Get the current camera mode.Returns the supported Render engine mode.boolean
Return if headlight is enabled.void
Set camera mode to perspective or orthographic.void
viewAll
(SbViewportRegion vpRegion) Set the camera to view all the scene.void
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.Methods inherited from class com.openinventor.inventor.nodes.SoGroup
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Constructor Details
-
SceneInteractor
public SceneInteractor()
-
-
Method Details
-
getRenderEngineMode
Description copied from class:SoNode
Returns the supported Render engine mode.For custom node, this method returns by default
SoNode.RenderModes.OIV_UNKNOWN_RENDERING_MODE
, override this method to specify the Render engine mode supported by your custom node.- Overrides:
getRenderEngineMode
in classSoNode
- Returns:
- the supported Render engine mode for this node.
-
setCameraMode
Set camera mode to perspective or orthographic. -
getCameraMode
Get the current camera mode. -
getCameraInteractor
- Returns:
- the current camera interactor
-
getCamera
Returns the current camera.- Returns:
- the current camera
-
adjustClippingPlanes
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
Set the camera to view all the scene. -
viewAxis
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.- Parameters:
direction
- the new view direction vectorup
- the new "up" direction
-
enableHeadlight
public void enableHeadlight(boolean enabled) Enable or disable headlight. -
isHeadlightEnabled
public boolean isHeadlightEnabled()Return if headlight is enabled.
-