Class KeyNavigatorEx

java.lang.Object
  |
  +--KeyNavigatorEx
Direct Known Subclasses:
PlayerKeyNavigator

public class KeyNavigatorEx
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
protected  javax.vecmath.Vector3d a
           
static int ALT
           
protected  javax.vecmath.Vector3d bwdAcc
           
protected  javax.vecmath.Vector3d bwdDrag
           
protected  double bwdVMax
           
static int DOWN_ARROW
           
protected  javax.vecmath.Vector3d downAcc
           
protected  javax.vecmath.Vector3d downDrag
           
protected  float downRotAngle
           
protected  double downVMax
           
protected  javax.vecmath.Point3d dp
           
protected  javax.vecmath.Vector3d dv
           
protected  javax.vecmath.Vector3d fwdAcc
           
protected  javax.vecmath.Vector3d fwdDrag
           
protected  double fwdVMax
           
static int HOME_DIR
           
static int HOME_NOMINAL
           
static int KEY_DOWN
           
protected  int key_state
           
static int KEY_UP
           
static int LEFT_ARROW
           
protected  javax.vecmath.Vector3d leftAcc
           
protected  javax.vecmath.Vector3d leftDrag
           
protected  float leftRotAngle
           
protected  double leftVMax
           
protected  javax.vecmath.Quat4d lrQuat
           
protected  int m_Backward
           
protected  int m_Equals
           
protected  int m_Forward
           
protected  int m_Left
           
protected  int m_Minus
           
protected  int m_Plus
           
protected  int m_Right
           
protected  int m_ViewDown
           
protected  int m_ViewUp
           
protected  javax.vecmath.Matrix4d mat
           
static int META
           
static int MINUS_SIGN
           
protected  double mmx
           
protected  int modifier_key_state
           
protected  javax.vecmath.Vector3d navVec
           
protected  javax.vecmath.Vector3d nda
           
protected  javax.media.j3d.Transform3D nominal
           
static int PAGE_DOWN
           
static int PAGE_UP
           
static int PLUS_SIGN
           
static int RIGHT_ARROW
           
protected  javax.vecmath.Vector3d rightAcc
           
protected  javax.vecmath.Vector3d rightDrag
           
protected  float rightRotAngle
           
protected  double rightVMax
           
static int SHIFT
           
protected  javax.media.j3d.TransformGroup targetTG
           
protected  javax.vecmath.Vector3d temp
           
protected  long time
           
protected  javax.vecmath.Quat4d udQuat
           
static int UP_ARROW
           
protected  javax.vecmath.Vector3d upAcc
           
protected  javax.vecmath.Vector3d upDrag
           
protected  float upRotAngle
           
protected  double upVMax
           
protected  javax.vecmath.Matrix4d vpMatrix
           
protected  javax.vecmath.Vector3d vpPos
           
protected  javax.vecmath.Quat4d vpQuat
           
protected  double vpScale
           
protected  javax.media.j3d.Transform3D vpTrans
           
 
Constructor Summary
KeyNavigatorEx(javax.media.j3d.TransformGroup targetTG)
          Constructs a new key navigator object that operates on the specified transform group.
 
Method Summary
protected  void accKeyAdd(javax.vecmath.Vector3d a, javax.vecmath.Vector3d da, javax.vecmath.Vector3d drag, double scaleVel)
           
protected  void genRotQuat(double av, int axis, javax.vecmath.Quat4d q)
           
protected  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.
protected  void resetVelocity()
          Resets the keyboard navigation velocity to 0.
 void setBackwardKey(int iKey)
           
 void setEqualKey(int iKey)
           
 void setForwardKey(int iKey)
           
 void setLeftKey(int iKey)
           
 void setMinusKey(int iKey)
           
 void setPlusKey(int iKey)
           
 void setRightKey(int iKey)
           
 void setViewDownKey(int iKey)
           
 void setViewUpKey(int iKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

navVec

protected javax.vecmath.Vector3d navVec

time

protected long time

fwdAcc

protected javax.vecmath.Vector3d fwdAcc

bwdAcc

protected javax.vecmath.Vector3d bwdAcc

leftAcc

protected javax.vecmath.Vector3d leftAcc

rightAcc

protected javax.vecmath.Vector3d rightAcc

upAcc

protected javax.vecmath.Vector3d upAcc

downAcc

protected javax.vecmath.Vector3d downAcc

fwdDrag

protected javax.vecmath.Vector3d fwdDrag

bwdDrag

protected javax.vecmath.Vector3d bwdDrag

leftDrag

protected javax.vecmath.Vector3d leftDrag

rightDrag

protected javax.vecmath.Vector3d rightDrag

upDrag

protected javax.vecmath.Vector3d upDrag

downDrag

protected javax.vecmath.Vector3d downDrag

fwdVMax

protected double fwdVMax

bwdVMax

protected double bwdVMax

leftVMax

protected double leftVMax

rightVMax

protected double rightVMax

upVMax

protected double upVMax

downVMax

protected double downVMax

leftRotAngle

protected float leftRotAngle

rightRotAngle

protected float rightRotAngle

upRotAngle

protected float upRotAngle

downRotAngle

protected float downRotAngle

mmx

protected double mmx

a

protected javax.vecmath.Vector3d a

dv

protected javax.vecmath.Vector3d dv

dp

protected javax.vecmath.Point3d dp

udQuat

protected javax.vecmath.Quat4d udQuat

lrQuat

protected javax.vecmath.Quat4d lrQuat

vpPos

protected javax.vecmath.Vector3d vpPos

vpScale

protected double vpScale

vpQuat

protected javax.vecmath.Quat4d vpQuat

vpMatrix

protected javax.vecmath.Matrix4d vpMatrix

vpTrans

protected javax.media.j3d.Transform3D vpTrans

mat

protected javax.vecmath.Matrix4d mat

nda

protected javax.vecmath.Vector3d nda

temp

protected javax.vecmath.Vector3d temp

nominal

protected javax.media.j3d.Transform3D nominal

targetTG

protected javax.media.j3d.TransformGroup targetTG

UP_ARROW

public static final int UP_ARROW

DOWN_ARROW

public static final int DOWN_ARROW

LEFT_ARROW

public static final int LEFT_ARROW

RIGHT_ARROW

public static final int RIGHT_ARROW

PLUS_SIGN

public static final int PLUS_SIGN

MINUS_SIGN

public static final int MINUS_SIGN

PAGE_UP

public static final int PAGE_UP

PAGE_DOWN

public static final int PAGE_DOWN

HOME_DIR

public static final int HOME_DIR

HOME_NOMINAL

public static final int HOME_NOMINAL

SHIFT

public static final int SHIFT

ALT

public static final int ALT

META

public static final int META

KEY_UP

public static final int KEY_UP

KEY_DOWN

public static final int KEY_DOWN

key_state

protected int key_state

modifier_key_state

protected int modifier_key_state

m_Forward

protected int m_Forward

m_Backward

protected int m_Backward

m_Left

protected int m_Left

m_Right

protected int m_Right

m_ViewUp

protected int m_ViewUp

m_ViewDown

protected int m_ViewDown

m_Equals

protected int m_Equals

m_Plus

protected int m_Plus

m_Minus

protected int m_Minus
Constructor Detail

KeyNavigatorEx

public KeyNavigatorEx(javax.media.j3d.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

protected long getDeltaTime()

genRotQuat

protected void genRotQuat(double av,
                          int axis,
                          javax.vecmath.Quat4d q)

accKeyAdd

protected void accKeyAdd(javax.vecmath.Vector3d a,
                         javax.vecmath.Vector3d da,
                         javax.vecmath.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

protected 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

setForwardKey

public void setForwardKey(int iKey)

setBackwardKey

public void setBackwardKey(int iKey)

setLeftKey

public void setLeftKey(int iKey)

setRightKey

public void setRightKey(int iKey)

setViewUpKey

public void setViewUpKey(int iKey)

setViewDownKey

public void setViewDownKey(int iKey)

setEqualKey

public void setEqualKey(int iKey)

setPlusKey

public void setPlusKey(int iKey)

setMinusKey

public void setMinusKey(int iKey)