org.jdesktop.wonderland.client.input
Class InputPicker

java.lang.Object
  extended by org.jdesktop.wonderland.client.input.InputPicker
Direct Known Subclasses:
InputPicker3D

public abstract class InputPicker
extends java.lang.Object

The abstract base class for an InputPicker singleton. The InputPicker is the part of the input subsystem which determines the pick details and the entity which an input event "hits." There are two mouse event processing methods. One method is used from WindowSwing code when a WindowSwing exists. This method performs a pick, determines whether it hits a WindowSwing and if so returns the pickInfo to the WindowSwing code. If a WindowSwing is not hit the pickInfo is stored for later use. The other mouse event processing method is used for events which don't hit a WindowSwing. These events come from the Canvas (via the InputManager). The processing for these events, called "3D events," attempts to avoid performing a pick by using pickInfo provided by WindowSwing, if available. (See previous paragraph). Note: the pick operation happens on the AWT event dispatch thread in all cases.

Author:
deronj

Field Summary
protected  EventDistributor eventDistributor
          The event distributor associated with this picker
protected static java.util.logging.Logger logger
           
 
Constructor Summary
protected InputPicker()
          Create a new instance of InputPicker.
 
Method Summary
protected abstract  Event createWonderlandEvent(java.util.EventObject eventObj)
          Converts a 2D AWT event into a Wonderland event.
protected  org.jdesktop.wonderland.client.input.InputPicker.DetermineDestPickInfoReturn determineDestPickInfo(java.awt.event.MouseEvent e)
          Performs a pick on the scene graph and determine the actual destination pick info taking into account button click threshold and mouse button grabbing.
 org.jdesktop.mtgame.CameraComponent getCameraComponent()
          Returns the camera component that is used for picking.
 com.jme.math.Matrix4f getCameraModelViewMatrix(com.jme.math.Matrix4f ret)
          Returns the current model view matrix of the camera.
 com.jme.math.Matrix4f getCameraModelViewMatrixInverse(com.jme.math.Matrix4f ret)
          Returns the current inverse model view matrix of the camera.
 com.jme.math.Vector3f getCameraPosition(com.jme.math.Vector3f ret)
          Returns the current camera position (in world coordinates).
 java.awt.Canvas getCanvas()
          Returns the canvas that is used for picking.
static void logPickInfo(java.lang.String str, org.jdesktop.mtgame.PickInfo pickInfo)
           
 InputManager.PickEventReturn pickMouseEventSwing(java.awt.event.MouseEvent awtMouseEvent)
          Picker for mouse events for the Embedded Swing case.
 void setCanvas(java.awt.Canvas canvas)
          Specify the canvas to be used for picking.
 void setEventDistributor(EventDistributor eventDistributor)
          Specify the associated event distributor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger

eventDistributor

protected EventDistributor eventDistributor
The event distributor associated with this picker

Constructor Detail

InputPicker

protected InputPicker()
Create a new instance of InputPicker.

Method Detail

setEventDistributor

public void setEventDistributor(EventDistributor eventDistributor)
Specify the associated event distributor.

Parameters:
eventDistributor -

pickMouseEventSwing

public InputManager.PickEventReturn pickMouseEventSwing(java.awt.event.MouseEvent awtMouseEvent)
Picker for mouse events for the Embedded Swing case. To be called by Embedded Swing toolkit createCoordinateHandler. Returns non-null if window is a WindowSwing. If it is a WindowSwing then return the appropriate hit entity and the corresponding pick info. Otherwise save the pickinfos the event to the event distributor as a 3D event.

Parameters:
awtEvent - The event whose entity and pickInfo need to be picked.
Returns:
An object of class PickEventReturn, which contains the return values entity and pickDetails.

determineDestPickInfo

protected org.jdesktop.wonderland.client.input.InputPicker.DetermineDestPickInfoReturn determineDestPickInfo(java.awt.event.MouseEvent e)
Performs a pick on the scene graph and determine the actual destination pick info taking into account button click threshold and mouse button grabbing. Returns the destination pick info in the global member destPickInfo.

Parameters:
e - The mouse event.
Returns:
The destination pick info.

logPickInfo

public static void logPickInfo(java.lang.String str,
                               org.jdesktop.mtgame.PickInfo pickInfo)

setCanvas

public void setCanvas(java.awt.Canvas canvas)
Specify the canvas to be used for picking.

Parameters:
canvas - The AWT canvas to use for picking operations.

getCanvas

public java.awt.Canvas getCanvas()
Returns the canvas that is used for picking.


getCameraComponent

public org.jdesktop.mtgame.CameraComponent getCameraComponent()
Returns the camera component that is used for picking.
INTERNAL ONLY.


getCameraPosition

public com.jme.math.Vector3f getCameraPosition(com.jme.math.Vector3f ret)
Returns the current camera position (in world coordinates).
INTERNAL ONLY.


getCameraModelViewMatrix

public com.jme.math.Matrix4f getCameraModelViewMatrix(com.jme.math.Matrix4f ret)
Returns the current model view matrix of the camera.
INTERNAL ONLY.


getCameraModelViewMatrixInverse

public com.jme.math.Matrix4f getCameraModelViewMatrixInverse(com.jme.math.Matrix4f ret)
Returns the current inverse model view matrix of the camera.
INTERNAL ONLY.


createWonderlandEvent

protected abstract Event createWonderlandEvent(java.util.EventObject eventObj)
Converts a 2D AWT event into a Wonderland event.



Open Wonderland - http://openwonderland.org