hmi.environment
Class NavigationControl

java.lang.Object
  extended by hmi.environment.NavigationControl
All Implemented Interfaces:
GLRenderObject, ClockListener

public class NavigationControl
extends Object
implements ClockListener, GLRenderObject

A simple form of keyboard based NavigationScene module. Keys: A and D move left and right, W and S move back and forth, Left and right "arrow" keys rotate, Up and down "arrow" keys move back and forth. PageUp and PageDown move up and down. One can pass required keymodifiers KeyEvent.VK_CONTROL/VK_ALT/VK_SHIFT at construction time


Field Summary
(package private)  float angVel
           
private static float conv
           
(package private)  double currentDoubleTime
           
static double degToRad
           
private  float inversionFactor
           
(package private)  KeyState keyState
           
(package private)  double lastTime
           
(package private)  float linVel
           
(package private)  float[] orientation
           
(package private)  float[] position
           
private  float[] rotation
           
private  float[] rotationMatrix
           
(package private)  float strafeVel
           
private  List<Integer> theKeyModifiers
           
private  float[] transformMatrix
           
private  float[] translation
           
private  float[] translationMatrix
           
(package private)  float vertVel
           
 
Constructor Summary
NavigationControl(Component c, VJoint viewpoint, boolean invert, int[] keyModifiers)
          Creates a new NavigationScene, listening to Component c for key and mouse events
 
Method Summary
private  boolean correctModifiers(KeyState keyState)
          Returns true if the keystate contains exactly those modifiers with which this control was initialized
 float[] getOrientation()
           
 float[] getPosition()
           
 void glInit(GLRenderContext gl)
          OpenGL initialization.
 void glRender(GLRenderContext gl)
          OpenGL rendering.
 void initTime(double currentTime)
          initTime() is called before the Clock starts running, and sends some initial time value.
 void setAngularVelocity(float vel)
           
 void setLinearVelocity(float vel)
           
 void setOrientation(float xrot, float yrot, float zrot)
          set the three Euler angles
 void setPosition(float[] pos)
          set the position vector
 void setPosition(float x, float y, float z)
          set the position vector
 void setRollPitchYaw(float roll, float pitch, float yaw)
           
 void setStrafeVelocity(float vel)
           
 void setTranslation(float tx, float ty, float tz)
           
 void setVelocities(float vel)
           
 void setVerticalVelocity(float vel)
           
 void time(double currentTime)
          Every clock tick, - check the new movements from the keystate, depending on the pressed keys - update the position and orientation of the controlled object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyState

KeyState keyState

position

float[] position

orientation

float[] orientation

currentDoubleTime

double currentDoubleTime

lastTime

double lastTime

linVel

float linVel

vertVel

float vertVel

strafeVel

float strafeVel

angVel

float angVel

degToRad

public static final double degToRad
See Also:
Constant Field Values

conv

private static final float conv
See Also:
Constant Field Values

rotation

private float[] rotation

translation

private float[] translation

transformMatrix

private float[] transformMatrix

rotationMatrix

private float[] rotationMatrix

translationMatrix

private float[] translationMatrix

theKeyModifiers

private List<Integer> theKeyModifiers

inversionFactor

private float inversionFactor
Constructor Detail

NavigationControl

public NavigationControl(Component c,
                         VJoint viewpoint,
                         boolean invert,
                         int[] keyModifiers)
Creates a new NavigationScene, listening to Component c for key and mouse events

Method Detail

setVelocities

public void setVelocities(float vel)

setLinearVelocity

public void setLinearVelocity(float vel)

setVerticalVelocity

public void setVerticalVelocity(float vel)

setStrafeVelocity

public void setStrafeVelocity(float vel)

setAngularVelocity

public void setAngularVelocity(float vel)

glInit

public void glInit(GLRenderContext gl)
OpenGL initialization.

Specified by:
glInit in interface GLRenderObject

glRender

public void glRender(GLRenderContext gl)
OpenGL rendering.

Specified by:
glRender in interface GLRenderObject

setPosition

public void setPosition(float[] pos)
set the position vector


setPosition

public void setPosition(float x,
                        float y,
                        float z)
set the position vector


getPosition

public float[] getPosition()

setOrientation

public void setOrientation(float xrot,
                           float yrot,
                           float zrot)
set the three Euler angles


getOrientation

public float[] getOrientation()

correctModifiers

private boolean correctModifiers(KeyState keyState)
Returns true if the keystate contains exactly those modifiers with which this control was initialized


initTime

public void initTime(double currentTime)
Description copied from interface: ClockListener
initTime() is called before the Clock starts running, and sends some initial time value. This will often equal the time send for the first regular time() call. This is done on the same clock Thread that is going to send the regular time() calls.

Specified by:
initTime in interface ClockListener

time

public void time(double currentTime)
Every clock tick, - check the new movements from the keystate, depending on the pressed keys - update the position and orientation of the controlled object

Specified by:
time in interface ClockListener

setRollPitchYaw

public void setRollPitchYaw(float roll,
                            float pitch,
                            float yaw)

setTranslation

public void setTranslation(float tx,
                           float ty,
                           float tz)