com.sun.j3d.utils.behaviors.keyboard
Class KeyNavigator

java.lang.Object
  extended by com.sun.j3d.utils.behaviors.keyboard.KeyNavigator

public class KeyNavigator
extends java.lang.Object

This is the KeyNavigator class. It accumulates AWT key events (key press and key release) and computes a new transform based on the accumulated events and elapsed time.


Field Summary
private  Vector3d a
           
private static int ALT
           
private  Vector3d bwdAcc
           
private  Vector3d bwdDrag
           
private  double bwdVMax
           
private static int DOWN_ARROW
           
private  Vector3d downAcc
           
private  Vector3d downDrag
           
private  float downRotAngle
           
private  double downVMax
           
private  Point3d dp
           
private  Vector3d dv
           
private  Vector3d fwdAcc
           
private  Vector3d fwdDrag
           
private  double fwdVMax
           
private static int HOME_DIR
           
private static int HOME_NOMINAL
           
private static int KEY_DOWN
           
private  int key_state
           
private static int KEY_UP
           
private static int LEFT_ARROW
           
private  Vector3d leftAcc
           
private  Vector3d leftDrag
           
private  float leftRotAngle
           
private  double leftVMax
           
private  Quat4d lrQuat
           
private  Matrix4d mat
           
private static int META
           
private static int MINUS_SIGN
           
private  double mmx
           
private  int modifier_key_state
           
private  Vector3d navVec
           
private  Vector3d nda
           
private  Transform3D nominal
           
private static int PAGE_DOWN
           
private static int PAGE_UP
           
private static int PLUS_SIGN
           
private static int RIGHT_ARROW
           
private  Vector3d rightAcc
           
private  Vector3d rightDrag
           
private  float rightRotAngle
           
private  double rightVMax
           
private static int SHIFT
           
private  TransformGroup targetTG
           
private  Vector3d temp
           
private  long time
           
private  Quat4d udQuat
           
private static int UP_ARROW
           
private  Vector3d upAcc
           
private  Vector3d upDrag
           
private  float upRotAngle
           
private  double upVMax
           
private  Matrix4d vpMatrix
           
private  Vector3d vpPos
           
private  Quat4d vpQuat
           
private  double vpScale
           
private  Transform3D vpTrans
           
 
Constructor Summary
KeyNavigator(TransformGroup targetTG)
          Constructs a new key navigator object that operates on the specified transform group.
 
Method Summary
private  void accKeyAdd(Vector3d a, Vector3d da, Vector3d drag, double scaleVel)
           
private  void genRotQuat(double av, int axis, Quat4d q)
           
private  long getDeltaTime()
           
 void integrateTransformChanges()
          Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time.
 void processKeyEvent(java.awt.event.KeyEvent keyEvent)
          Processed a keyboard event.
private  void resetVelocity()
          Resets the keyboard navigation velocity to 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

navVec

private Vector3d navVec

time

private long time

fwdAcc

private Vector3d fwdAcc

bwdAcc

private Vector3d bwdAcc

leftAcc

private Vector3d leftAcc

rightAcc

private Vector3d rightAcc

upAcc

private Vector3d upAcc

downAcc

private Vector3d downAcc

fwdDrag

private Vector3d fwdDrag

bwdDrag

private Vector3d bwdDrag

leftDrag

private Vector3d leftDrag

rightDrag

private Vector3d rightDrag

upDrag

private Vector3d upDrag

downDrag

private Vector3d downDrag

fwdVMax

private double fwdVMax

bwdVMax

private double bwdVMax

leftVMax

private double leftVMax

rightVMax

private double rightVMax

upVMax

private double upVMax

downVMax

private double downVMax

leftRotAngle

private float leftRotAngle

rightRotAngle

private float rightRotAngle

upRotAngle

private float upRotAngle

downRotAngle

private float downRotAngle

mmx

private double mmx

a

private Vector3d a

dv

private Vector3d dv

dp

private Point3d dp

udQuat

private Quat4d udQuat

lrQuat

private Quat4d lrQuat

vpPos

private Vector3d vpPos

vpScale

private double vpScale

vpQuat

private Quat4d vpQuat

vpMatrix

private Matrix4d vpMatrix

vpTrans

private Transform3D vpTrans

mat

private Matrix4d mat

nda

private Vector3d nda

temp

private Vector3d temp

nominal

private Transform3D nominal

targetTG

private TransformGroup targetTG

UP_ARROW

private static final int UP_ARROW
See Also:
Constant Field Values

DOWN_ARROW

private static final int DOWN_ARROW
See Also:
Constant Field Values

LEFT_ARROW

private static final int LEFT_ARROW
See Also:
Constant Field Values

RIGHT_ARROW

private static final int RIGHT_ARROW
See Also:
Constant Field Values

PLUS_SIGN

private static final int PLUS_SIGN
See Also:
Constant Field Values

MINUS_SIGN

private static final int MINUS_SIGN
See Also:
Constant Field Values

PAGE_UP

private static final int PAGE_UP
See Also:
Constant Field Values

PAGE_DOWN

private static final int PAGE_DOWN
See Also:
Constant Field Values

HOME_DIR

private static final int HOME_DIR
See Also:
Constant Field Values

HOME_NOMINAL

private static final int HOME_NOMINAL
See Also:
Constant Field Values

SHIFT

private static final int SHIFT
See Also:
Constant Field Values

ALT

private static final int ALT
See Also:
Constant Field Values

META

private static final int META
See Also:
Constant Field Values

KEY_UP

private static final int KEY_UP
See Also:
Constant Field Values

KEY_DOWN

private static final int KEY_DOWN
See Also:
Constant Field Values

key_state

private int key_state

modifier_key_state

private int modifier_key_state
Constructor Detail

KeyNavigator

public KeyNavigator(TransformGroup targetTG)
Constructs a new key navigator object that operates on the specified transform group. All parameters are set to their default, idle state.

Parameters:
targetTG - the target transform group
Method Detail

getDeltaTime

private long getDeltaTime()

genRotQuat

private void genRotQuat(double av,
                        int axis,
                        Quat4d q)

accKeyAdd

private void accKeyAdd(Vector3d a,
                       Vector3d da,
                       Vector3d drag,
                       double scaleVel)

integrateTransformChanges

public void integrateTransformChanges()
Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time. This new transform is written into the target transform group. This method should be called once per frame.


resetVelocity

private void resetVelocity()
Resets the keyboard navigation velocity to 0.


processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent keyEvent)
Processed a keyboard event. This routine should be called every time a KEY_PRESSED or KEY_RELEASED event is received.

Parameters:
keyEvent - the AWT key event


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.