Package org.xj3d.core.eventmodel
Interface UserInputHandler
- All Superinterfaces:
OriginListener
- All Known Subinterfaces:
OGLUserInputHandler
- All Known Implementing Classes:
DefaultUserInputHandler
A complete handler for all user input information within a scene.
The handler takes care of all the handling needed for sensors, anchors, navigation and keyboard. However, it does not define a way of sourcing those events as it assumes that a user will either delegate or extend this class with more specific information such as an AWT listener or Java3D behavior.
The current key handling does not allow keyboard navigation of the world. It passes all key events directly through to the current key sensor if one is registered.
- Version:
- $Revision: 1.7 $
- Author:
- Alan Hudson
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a navigationStateListener.void
Add a sensorStatusListener.void
clear()
Clear all the values, listeners etc, except for the clock.boolean
Get the currently set navigation state.void
getOrientation
(javax.vecmath.AxisAngle4f ori) Get the current user orientation.void
getPosition
(javax.vecmath.Vector3f pos) Get the current user position.void
Process any navigation velocity.void
Remove a navigationStateListener.void
Remove a sensorStatusListener.void
The layer that contains this handler has just been made the active navigation layer, so send out to the navigation state listeners the current navigation state for this layer.void
setActivateSensors
(boolean val) Sets whether this tracker is eligible to active a sensor.void
setCenterOfRotation
(float[] center) Set the center of rotation explicitly to this place.void
setNavigationEnabled
(boolean state) Enable or disable navigation processing sub-section of the user input processing.void
Set the navigation info that is used for this scene.boolean
setNavigationMode
(String mode) Set the desired navigation mode.void
setOriginManager
(OriginManager manager) Set the manager for handling dynamic origin calculation.void
setTestPointingDevices
(boolean enabled) Should pointing devices be tested for.void
setVRMLClock
(VRMLClock clk) Set the clock we are going to operate from when generating events.void
setWorldScale
(float scale) Set the world scale applied.void
trackerButton
(int tracker, org.j3d.device.input.TrackerState state) Process the buttons on a tracker.void
trackerClicked
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker click event.void
trackerDragged
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event.boolean
Did the last tracker interaction intersect any active sensors.void
trackerMoved
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event.void
trackerOrientation
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker orientation event.void
trackerPressed
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event.void
trackerReleased
(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event.void
trackerWheel
(int tracker, org.j3d.device.input.TrackerState state) Process the wheel on a tracker.Methods inherited from interface org.xj3d.core.eventmodel.OriginListener
originChanged
-
Method Details
-
trackerPressed
void trackerPressed(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event. This may be used to start a touchSensor, start of a drag sensor or navigation- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerMoved
void trackerMoved(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event. This may be used to start a touchtracker, start of a drag tracker or navigation- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerDragged
void trackerDragged(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event. This may be used to start a touchtracker, start of a drag tracker or navigation- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerReleased
void trackerReleased(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker press event. This may be used to start a touchtracker, start of a drag tracker or navigation- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerClicked
void trackerClicked(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker click event. The click is used only on touch trackers and anchors. We treat it like a cross between a select and unselect.- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerOrientation
void trackerOrientation(int tracker, org.j3d.device.input.TrackerState evt) Process a tracker orientation event. This is for trackers like HMDs that can change orientation without changing position or other state.- Parameters:
tracker
- The id of the tracker calling this handlerevt
- The event that caused the method to be called
-
trackerButton
void trackerButton(int tracker, org.j3d.device.input.TrackerState state) Process the buttons on a tracker. No other state will be read.- Parameters:
tracker
- The id of the tracker calling this handlerstate
- The current state.
-
trackerWheel
void trackerWheel(int tracker, org.j3d.device.input.TrackerState state) Process the wheel on a tracker. No other state will be read.- Parameters:
tracker
- The id of the tracker calling this handlerstate
- The current state.
-
trackerIntersected
boolean trackerIntersected()Did the last tracker interaction intersect any active sensors.- Returns:
- true if the tracker intersection an active sensor.
-
setActivateSensors
void setActivateSensors(boolean val) Sets whether this tracker is eligible to active a sensor.- Parameters:
val
- Whether its eligible
-
addSensorStatusListener
Add a sensorStatusListener. Duplicates and null will be ignored.- Parameters:
l
- The listener to add
-
removeSensorStatusListener
Remove a sensorStatusListener.- Parameters:
l
- The listener to remove
-
setTestPointingDevices
void setTestPointingDevices(boolean enabled) Should pointing devices be tested for.- Parameters:
enabled
- Test for intersection when true
-
setWorldScale
void setWorldScale(float scale) Set the world scale applied. This will scale down navinfo parameters to fit into the world.- Parameters:
scale
- The new world scale.
-
getOrientation
void getOrientation(javax.vecmath.AxisAngle4f ori) Get the current user orientation.- Parameters:
ori
- The orientation vector to fill in
-
getPosition
void getPosition(javax.vecmath.Vector3f pos) Get the current user position.- Parameters:
pos
- The position vector to fill in
-
setCenterOfRotation
void setCenterOfRotation(float[] center) Set the center of rotation explicitly to this place. Coordinates must be in the coordinate space of the current view transform group. The provided array must be of least length 3. Center of rotation is used in examine mode.- Parameters:
center
- The new center to use
-
setVRMLClock
Set the clock we are going to operate from when generating events. A null value will remove the clock.- Parameters:
clk
- The new clock to use
-
clear
void clear()Clear all the values, listeners etc, except for the clock. Returns the input handler back to being empty, with no state set. -
setOriginManager
Set the manager for handling dynamic origin calculation.- Parameters:
manager
- Reference to the manager instance to use or null
-