| javax.media.j3d.InputDevice
All known Subclasses: com.sun.j3d.utils.trackers.Tracker, org.jdesktop.j3d.examples.virtual_input_device.VirtualInputDevice,
InputDevice | public interface InputDevice (Code) | | InputDevice is the interface through which Java 3D and Java 3D
application programs communicate with a device driver. All input
devices that Java 3D uses must implement the InputDevice interface and
be registered with Java 3D via a call to
PhysicalEnvironment.addInputDevice(InputDevice). An input device
transfers information to the Java 3D implementation and Java 3D
applications by writing transform information to sensors that the
device driver has created and manages. The driver can update its
sensor information each time the pollAndProcessInput method is
called.
|
Field Summary | |
final public static int | BLOCKING Signifies that the driver for a device is a blocking driver and that
it should be scheduled for regular reads by Java 3D. | final public static int | DEMAND_DRIVEN Signifies that the Java 3D implementation should not schedule
regular reads on the sensors of this device; the Java 3D
implementation will only call pollAndProcessInput when one of the
device's sensors' getRead methods is called. | final public static int | NON_BLOCKING Signifies that the driver for a device is a non-blocking driver and
that it should be scheduled for regular reads by Java 3D. |
Method Summary | |
abstract public void | close() Code to process the clean up of the device and relinquish associated
resources. | abstract public int | getProcessingMode() This method retrieves the device's processing mode: one of BLOCKING,
NON_BLOCKING, or DEMAND_DRIVEN. | public Sensor | getSensor(int sensorIndex) Gets the specified Sensor associated with the device. | public int | getSensorCount() This method gets the number of sensors associated with the device. | abstract public boolean | initialize() This method initializes the device. | abstract public void | pollAndProcessInput() This method causes the device's sensor readings to be updated by the
device driver. | abstract public void | processStreamInput() This method will not be called by the Java 3D implementation and
should be implemented as an empty method. | abstract public void | setNominalPositionAndOrientation() This method sets the device's current position and orientation as the
devices nominal position and orientation (establish its reference
frame relative to the "Tracker base" reference frame). | abstract public void | setProcessingMode(int mode) This method sets the device's processing mode to one of: BLOCKING,
NON_BLOCKING, or DEMAND_DRIVEN. |
BLOCKING | final public static int BLOCKING(Code) | | Signifies that the driver for a device is a blocking driver and that
it should be scheduled for regular reads by Java 3D. A blocking driver
is defined as a driver that can cause the thread accessing the driver
(the Java 3D implementation thread calling the pollAndProcessInput
method) to block while the data is being accessed from the driver.
|
DEMAND_DRIVEN | final public static int DEMAND_DRIVEN(Code) | | Signifies that the Java 3D implementation should not schedule
regular reads on the sensors of this device; the Java 3D
implementation will only call pollAndProcessInput when one of the
device's sensors' getRead methods is called. A DEMAND_DRIVEN driver
must always provide the current value of the sensor on demand whenever
pollAndProcessInput is called. This means that DEMAND_DRIVEN drivers
are non-blocking by definition.
|
NON_BLOCKING | final public static int NON_BLOCKING(Code) | | Signifies that the driver for a device is a non-blocking driver and
that it should be scheduled for regular reads by Java 3D. A
non-blocking driver is defined as a driver that does not cause the
calling thread to block while data is being retrieved from the
driver. If no data is available from the device, pollAndProcessInput
should return without updating the sensor read value.
|
close | abstract public void close()(Code) | | Code to process the clean up of the device and relinquish associated
resources. This method should be called after the device has been
unregistered from Java 3D via the
PhysicalEnvironment.removeInputDevice(InputDevice) method call.
|
getProcessingMode | abstract public int getProcessingMode()(Code) | | This method retrieves the device's processing mode: one of BLOCKING,
NON_BLOCKING, or DEMAND_DRIVEN. The Java 3D implementation calls
this method when PhysicalEnvironment.addInputDevice(InputDevice) is
called to register the device with Java 3D. If this method returns
any value other than BLOCKING, NON_BLOCKING, or DEMAND_DRIVEN,
addInputDevice will throw an IllegalArgumentException.
Returns the devices processing mode, one of BLOCKING, NON_BLOCKING, or DEMAND_DRIVEN |
getSensor | public Sensor getSensor(int sensorIndex)(Code) | | Gets the specified Sensor associated with the device. Each InputDevice
implementation is responsible for creating and managing its own set of
sensors. The sensor indices begin at zero and end at number of
sensors minus one. Each sensor should have had
Sensor.setDevice(InputDevice) set properly before addInputDevice
is called.
Parameters: sensorIndex - the sensor to retrieve Returns the specified sensor. |
getSensorCount | public int getSensorCount()(Code) | | This method gets the number of sensors associated with the device.
the device's sensor count. |
initialize | abstract public boolean initialize()(Code) | | This method initializes the device. A device should be initialized
before it is registered with Java 3D via the
PhysicalEnvironment.addInputDevice(InputDevice) method call.
return true for succesful initialization, false for failure |
pollAndProcessInput | abstract public void pollAndProcessInput()(Code) | | This method causes the device's sensor readings to be updated by the
device driver. For BLOCKING and NON_BLOCKING drivers, this method is
called regularly and the Java 3D implementation can cache the sensor
values. For DEMAND_DRIVEN drivers this method is called each time one
of the Sensor.getRead methods is called, and is not otherwise called.
|
processStreamInput | abstract public void processStreamInput()(Code) | | This method will not be called by the Java 3D implementation and
should be implemented as an empty method.
|
setNominalPositionAndOrientation | abstract public void setNominalPositionAndOrientation()(Code) | | This method sets the device's current position and orientation as the
devices nominal position and orientation (establish its reference
frame relative to the "Tracker base" reference frame).
|
setProcessingMode | abstract public void setProcessingMode(int mode)(Code) | | This method sets the device's processing mode to one of: BLOCKING,
NON_BLOCKING, or DEMAND_DRIVEN. Many drivers will be written to run
in only one mode. Applications using such drivers should not attempt
to set the processing mode. This method should throw an
IllegalArgumentException if there is an attempt to set the processing
mode to anything other than the aforementioned three values.
NOTE: this method should not be called after the input
device has been added to a PhysicalEnvironment. The
processingMode must remain constant while a device is attached
to a PhysicalEnvironment.
Parameters: mode - One of BLOCKING, NON_BLOCKING, or DEMAND_DRIVEN |
|
|