net.java.joglutils.msg.actions
Class RayPickAction

java.lang.Object
  extended by net.java.joglutils.msg.actions.Action
      extended by net.java.joglutils.msg.actions.RayPickAction

public class RayPickAction
extends Action


Constructor Summary
RayPickAction()
           
 
Method Summary
static void addActionMethod(Class<? extends Node> nodeType, Method m)
          Adds an action method for the given node type to this action.
 void addPickedPoint(PickedPoint p, float t)
          Registers a picked point with the RayPickAction during scene graph traversal.
 void apply(Node node)
          Applies this Action to a particular node.
 Line getComputedRay()
          Returns the computed 3D ray in world coordinates that this RayPickAction is using for its picking.
static State getDefaultState()
          Returns the default state all instances of this class are initialized with.
 PickedPoint getPickedPoint()
          Returns the closest point to the camera this action selected during the last traversal, or null if no points were picked.
 List<PickedPoint> getPickedPoints()
          Returns the list of points this action selected during the last traversal, sorted in increasing order of distance from the camera.
 State getState()
          Returns the global state this action encompasses, which is altered by the nodes the action traverses.
static void rayPick(RayPickAction action, Node node)
          Action method which dispatches to per-node rendering functionality.
 void recomputeRay(Camera camera)
          Called during scene graph traversal to update the 3D ray associated with this action if it was configured with on-screen coordinates.
 void setNormalizedPoint(Vec2f normalizedPoint)
          Sets the normalized point for this RayPickAction, where x and y are relative to the lower-left of the viewport and range from [0..1].
 void setPoint(int x, int y, Component component)
          Sets the point for this RayPickAction based on x and y coordinates relative to the specified AWT Component.
 void setRay(Line ray)
          Sets the ray in world coordinates that this RayPickAction should use for its computation.
 
Methods inherited from class net.java.joglutils.msg.actions.Action
apply, getPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RayPickAction

public RayPickAction()
Method Detail

getDefaultState

public static State getDefaultState()
Returns the default state all instances of this class are initialized with.


addActionMethod

public static void addActionMethod(Class<? extends Node> nodeType,
                                   Method m)
Adds an action method for the given node type to this action. This should only be called by developers adding new node types and not desiring to use the standard overriding mechanisms.


getState

public State getState()
Description copied from class: Action
Returns the global state this action encompasses, which is altered by the nodes the action traverses.

Specified by:
getState in class Action

apply

public void apply(Node node)
Description copied from class: Action
Applies this Action to a particular node. This is how operations such as rendering are initiated.

Specified by:
apply in class Action

setPoint

public void setPoint(int x,
                     int y,
                     Component component)
Sets the point for this RayPickAction based on x and y coordinates relative to the specified AWT Component.


setNormalizedPoint

public void setNormalizedPoint(Vec2f normalizedPoint)
Sets the normalized point for this RayPickAction, where x and y are relative to the lower-left of the viewport and range from [0..1].


setRay

public void setRay(Line ray)
Sets the ray in world coordinates that this RayPickAction should use for its computation.


getPickedPoints

public List<PickedPoint> getPickedPoints()
Returns the list of points this action selected during the last traversal, sorted in increasing order of distance from the camera. Typically applications will only need to deal with the first point in the returned list.


getPickedPoint

public PickedPoint getPickedPoint()
Returns the closest point to the camera this action selected during the last traversal, or null if no points were picked.


getComputedRay

public Line getComputedRay()
Returns the computed 3D ray in world coordinates that this RayPickAction is using for its picking. If the action is configured with on-screen coordinates instead of with a 3D ray, then this is automatically updated every time the action traverses a Camera node. May return null if this has not been computed yet. End users should not need to call this method.


recomputeRay

public void recomputeRay(Camera camera)
Called during scene graph traversal to update the 3D ray associated with this action if it was configured with on-screen coordinates. End users should not need to call this method.


addPickedPoint

public void addPickedPoint(PickedPoint p,
                           float t)
Registers a picked point with the RayPickAction during scene graph traversal. The t argument is the time parameter indicating the distance from the camera. A reference to the PickedPoint is maintained internally so the caller should add a copy if the original is still mutable. End users should not need to call this method.


rayPick

public static void rayPick(RayPickAction action,
                           Node node)
Action method which dispatches to per-node rendering functionality.