Class JavaApplication3D
- java.lang.Object
-
- WildMagic.LibApplications.OpenGLApplication.Application
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication
-
- WildMagic.LibApplications.OpenGLApplication.JavaApplication3D
-
- All Implemented Interfaces:
java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.io.Serializable
,java.util.EventListener
public abstract class JavaApplication3D extends JavaApplication implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected float[]
cameraParams
Camera parameters.protected Vector3f[]
m_akWorldAxis
camera motion parametersprotected boolean
m_bCameraMoveable
flag indicating the camera is movableprotected boolean
m_bDArrowPressed
flag indicating the down arrow was pressedprotected boolean
m_bEndPressed
flag indicating the end key was pressedprotected boolean
m_bHomePressed
flag indicating the home key was pressedprotected boolean
m_bLArrowPressed
flag indicating the left arrow was pressedprotected boolean
m_bLInsertPressed
flag indicating the insert key was pressed.protected boolean
m_bObjectZoomed
Trackball rotation flags:protected boolean
m_bPgDnPressed
flag indicating page down was pressedprotected boolean
m_bPgUpPressed
flag indicating page up was pressedprotected boolean
m_bRArrowPressed
flag indicating the right arrow was pressedprotected boolean
m_bRDeletePressed
flag indicating the delete key was pressed.protected boolean
m_bTrackBallDown
Trackball rotation flags:protected boolean
m_bUArrowPressed
flag indicating the up arrow was pressedprotected boolean
m_bUseTrackBall
Trackball rotation flags:protected double
m_dAccumulatedTime
Frame-rate Performance parameters:protected double
m_dFrameRate
Frame-rate Performance parameters:protected double
m_dLastTime
Frame-rate Performance parameters:protected float
m_fRotSpeed
Rotation speedprotected float
m_fRotSpeedFactor
Increase/Decrease rotation speed factorprotected float
m_fTrnSpeed
Translation speedprotected float
m_fTrnSpeedFactor
Increase/Decrease translation speed factorprotected float
m_fXDrag0
Drag xy pixel coordinates:protected float
m_fXTrack0
Trackball start and end xy pixel coordinates:protected float
m_fXTrack1
Trackball start and end xy pixel coordinates:protected float
m_fYDrag0
Drag xy pixel coordinates:protected float
m_fYTrack0
Trackball start and end xy pixel coordinates:protected float
m_fYTrack1
Trackball start and end xy pixel coordinates:protected float
m_fZoomSpeed
Zoom speedprotected int
m_iAccumulatedFrameCount
Frame-rate Performance parameters:protected int
m_iDoPitch
Roll, yaw, pitch:protected int
m_iDoRoll
Roll, yaw, pitch:protected int
m_iDoYaw
Roll, yaw, pitch:protected int
m_iFrameCount
Frame-rate Performance parameters:protected int
m_iMaxTimer
Frame-rate Performance parameters:protected int
m_iMouseButton
The last button on the mouse to be pressed/releasedprotected int
m_iTimer
Frame-rate Performance parameters:protected Matrix3f
m_kSaveRotate
Current rotation, saved during trackball rotate:protected float
m_mouseRotSpeed
mouse control rotation speedprotected Camera
m_spkCamera
Camera object.protected Spatial
m_spkMotionObject
Object rotation node:private float[]
objectParams
Object rotation parameters.protected float
pitchRotationAngle
Roll, yaw, pitch rotation angleprotected float
rollRotationAngle
Roll, yaw, pitch rotation angleprivate static long
serialVersionUID
protected float
xCameraMove
Move the camera right or left.protected float
xCameraTurn
Turn the camera left or right.protected float
yawRotationAngle
Roll, yaw, pitch rotation angleprotected float
yCameraMove
Move the camera up or down.protected float
yCameraTurn
Turn the camera to up or down.protected float
zCameraMove
Move the camera forward or backward.-
Fields inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
m_acWindowTitle, m_eBuffering, m_eDepth, m_eFormat, m_eMultisampling, m_eStencil, m_iHeight, m_iWidth, m_iXPosition, m_iYPosition, m_kBackgroundColor, m_pkRenderer
-
-
Constructor Summary
Constructors Constructor Description JavaApplication3D(java.lang.String acWindowTitle, int iXPosition, int iYPosition, int iWidth, int iHeight, ColorRGBA rkBackgroundColor)
Creates a new JavaApplication3.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Delete memory.protected void
DrawFrameRate(int iX, int iY, ColorRGBA rkColor)
Performance measurement: Draws the frame rate on screenVector3f
getCameraLocation()
Get the camera current locationfloat[]
getCameraParameters()
Get the camera parameters for move and turn.float[]
getObjectParameters()
Get the object rotation parameters ( roll, pitch, yaw )Matrix3f
getObjectRotation()
Get the object rotation matrix.protected void
InitializeCameraMotion(float fTrnSpeed, float fRotSpeed)
Initialize Camera Motionprotected void
InitializeCameraMotion(float fTrnSpeed, float fRotSpeed, float fTrnSpeedFactor, float fRotSpeedFactor)
Initialize Camera Motionprotected void
InitializeObjectMotion(Spatial pkMotionObject)
Initializes Object Motionvoid
keyPressed(java.awt.event.KeyEvent kKey)
keyPressed callback.void
keyReleased(java.awt.event.KeyEvent kKey)
keyReleased callback.void
keyTyped(java.awt.event.KeyEvent e)
protected void
LookDown()
Causes the camera to look down.protected void
LookUp()
Causes the camera to look up.protected void
MeasureTime()
Performance measurement: Measure timevoid
mouseClicked(java.awt.event.MouseEvent e)
User input: stubvoid
mouseDragged(java.awt.event.MouseEvent e)
Rotates the object with a virtual trackball:void
mouseEntered(java.awt.event.MouseEvent e)
User input: stubvoid
mouseExited(java.awt.event.MouseEvent e)
User input: stubvoid
mouseMoved(java.awt.event.MouseEvent e)
User input: stubvoid
mousePressed(java.awt.event.MouseEvent e)
Initializes trackball rotation:void
mouseReleased(java.awt.event.MouseEvent e)
Ends trackball rotation:void
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
protected void
MoveBackward()
Moves the camera backward.protected boolean
MoveCamera()
Camera Motionprotected void
MoveDown()
Moves the camera down.protected void
MoveForward()
Moves the camera forward.protected void
MoveLeft()
Moves the camera left.protected boolean
MoveObject()
Moves object.protected void
MoveRight()
Moves the camera right.protected void
MoveUp()
Moves the camera up.void
OnDisplay()
OnDisplay callback, called when the application window is displayed.boolean
OnInitialize()
OnInitialize callback, called when the application is created.void
OnTerminate()
OnTerminate callback, called when the application terminates.protected void
ResetTime()
Performance measurement: Resets timeprotected void
RotateTrackBall(float fX0, float fY0, float fX1, float fY1)
Rotate the the object with a virtual trackballvoid
setCameraLocation(Vector3f v)
Set the camera location.void
setCameraParameters(float[] newCameraParams)
Get the camera parameters for move and turn.void
setObjectParameters(float[] newObjectParams)
Get the object rotation parameters ( roll, pitch, yaw )void
setObjectRotation(Matrix3f rot)
Set the object rotation matrixprotected void
TurnLeft()
Turns the camera left.protected void
TurnRight()
Turns the camera right.protected void
UpdateCameraRotationSpeed(float fRotSpeed)
update camera rotation speedprotected void
UpdateCameraTranslationSpeed(float fTrnSpeed)
update camera translation speedprotected void
UpdateCameraZoomSpeed(float fZoomSpeed)
update camera zoom speedprotected void
UpdateFrameCount()
Performance measurement: Update frame countprotected void
UpdateMouseRotationSpeed(float fRotSpeed)
update camera rotation speed-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.JavaApplication
GetAspectRatio, GetHeight, GetRenderer, GetWidth, GetWindowTitle, GetXPosition, GetYPosition, OnIdle, OnMove, OnPrecreate, OnResize, SetRenderer
-
Methods inherited from class WildMagic.LibApplications.OpenGLApplication.Application
reloadShaders, TestStreaming
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_spkCamera
protected Camera m_spkCamera
Camera object.
-
m_akWorldAxis
protected Vector3f[] m_akWorldAxis
camera motion parameters
-
m_fTrnSpeed
protected float m_fTrnSpeed
Translation speed
-
m_fRotSpeed
protected float m_fRotSpeed
Rotation speed
-
m_fZoomSpeed
protected float m_fZoomSpeed
Zoom speed
-
m_bLInsertPressed
protected boolean m_bLInsertPressed
flag indicating the insert key was pressed.
-
m_bRDeletePressed
protected boolean m_bRDeletePressed
flag indicating the delete key was pressed.
-
m_fTrnSpeedFactor
protected float m_fTrnSpeedFactor
Increase/Decrease translation speed factor
-
m_fRotSpeedFactor
protected float m_fRotSpeedFactor
Increase/Decrease rotation speed factor
-
m_bUArrowPressed
protected boolean m_bUArrowPressed
flag indicating the up arrow was pressed
-
m_bDArrowPressed
protected boolean m_bDArrowPressed
flag indicating the down arrow was pressed
-
m_bLArrowPressed
protected boolean m_bLArrowPressed
flag indicating the left arrow was pressed
-
m_bRArrowPressed
protected boolean m_bRArrowPressed
flag indicating the right arrow was pressed
-
m_bPgUpPressed
protected boolean m_bPgUpPressed
flag indicating page up was pressed
-
m_bPgDnPressed
protected boolean m_bPgDnPressed
flag indicating page down was pressed
-
m_bHomePressed
protected boolean m_bHomePressed
flag indicating the home key was pressed
-
m_bEndPressed
protected boolean m_bEndPressed
flag indicating the end key was pressed
-
m_bCameraMoveable
protected boolean m_bCameraMoveable
flag indicating the camera is movable
-
m_iMouseButton
protected int m_iMouseButton
The last button on the mouse to be pressed/released
-
zCameraMove
protected float zCameraMove
Move the camera forward or backward.
-
yCameraMove
protected float yCameraMove
Move the camera up or down.
-
xCameraMove
protected float xCameraMove
Move the camera right or left.
-
xCameraTurn
protected float xCameraTurn
Turn the camera left or right.
-
yCameraTurn
protected float yCameraTurn
Turn the camera to up or down.
-
cameraParams
protected float[] cameraParams
Camera parameters.
-
m_spkMotionObject
protected Spatial m_spkMotionObject
Object rotation node:
-
m_iDoRoll
protected int m_iDoRoll
Roll, yaw, pitch:
-
m_iDoYaw
protected int m_iDoYaw
Roll, yaw, pitch:
-
m_iDoPitch
protected int m_iDoPitch
Roll, yaw, pitch:
-
rollRotationAngle
protected float rollRotationAngle
Roll, yaw, pitch rotation angle
-
yawRotationAngle
protected float yawRotationAngle
Roll, yaw, pitch rotation angle
-
pitchRotationAngle
protected float pitchRotationAngle
Roll, yaw, pitch rotation angle
-
objectParams
private float[] objectParams
Object rotation parameters.
-
m_fXTrack0
protected float m_fXTrack0
Trackball start and end xy pixel coordinates:
-
m_fYTrack0
protected float m_fYTrack0
Trackball start and end xy pixel coordinates:
-
m_fXTrack1
protected float m_fXTrack1
Trackball start and end xy pixel coordinates:
-
m_fYTrack1
protected float m_fYTrack1
Trackball start and end xy pixel coordinates:
-
m_fXDrag0
protected float m_fXDrag0
Drag xy pixel coordinates:
-
m_fYDrag0
protected float m_fYDrag0
Drag xy pixel coordinates:
-
m_kSaveRotate
protected Matrix3f m_kSaveRotate
Current rotation, saved during trackball rotate:
-
m_bUseTrackBall
protected boolean m_bUseTrackBall
Trackball rotation flags:
-
m_bTrackBallDown
protected boolean m_bTrackBallDown
Trackball rotation flags:
-
m_bObjectZoomed
protected boolean m_bObjectZoomed
Trackball rotation flags:
-
m_dLastTime
protected double m_dLastTime
Frame-rate Performance parameters:
-
m_dAccumulatedTime
protected double m_dAccumulatedTime
Frame-rate Performance parameters:
-
m_dFrameRate
protected double m_dFrameRate
Frame-rate Performance parameters:
-
m_iFrameCount
protected int m_iFrameCount
Frame-rate Performance parameters:
-
m_iAccumulatedFrameCount
protected int m_iAccumulatedFrameCount
Frame-rate Performance parameters:
-
m_iTimer
protected int m_iTimer
Frame-rate Performance parameters:
-
m_iMaxTimer
protected int m_iMaxTimer
Frame-rate Performance parameters:
-
m_mouseRotSpeed
protected float m_mouseRotSpeed
mouse control rotation speed
-
-
Constructor Detail
-
JavaApplication3D
public JavaApplication3D(java.lang.String acWindowTitle, int iXPosition, int iYPosition, int iWidth, int iHeight, ColorRGBA rkBackgroundColor)
Creates a new JavaApplication3.- Parameters:
acWindowTitle
- the window titleiXPosition
- window screen x-positioniYPosition
- window screen y-positioniWidth
- window widthiHeight
- window heightrkBackgroundColor
- background color
-
-
Method Detail
-
dispose
public void dispose()
Delete memory.- Overrides:
dispose
in classJavaApplication
-
getCameraLocation
public Vector3f getCameraLocation()
Get the camera current location- Returns:
- camera position vector
-
getCameraParameters
public float[] getCameraParameters()
Get the camera parameters for move and turn.- Returns:
- camera parameter array
-
getObjectParameters
public float[] getObjectParameters()
Get the object rotation parameters ( roll, pitch, yaw )- Returns:
- Object rotation parameters array
-
getObjectRotation
public Matrix3f getObjectRotation()
Get the object rotation matrix.- Returns:
- rotation matrix
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent kKey)
keyPressed callback.- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
- Overrides:
keyPressed
in classJavaApplication
- Parameters:
kKey
- the KeyEvent triggering the callback.
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent kKey)
keyReleased callback.- Specified by:
keyReleased
in interfacejava.awt.event.KeyListener
- Overrides:
keyReleased
in classJavaApplication
- Parameters:
kKey
- the KeyEvent triggering the callback.
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTyped
in interfacejava.awt.event.KeyListener
- Overrides:
keyTyped
in classJavaApplication
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the MouseEvent
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
Rotates the object with a virtual trackball:- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Parameters:
e
- the MouseEvent
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the MouseEvent
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the MouseEvent
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Parameters:
e
- the MouseEvent
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
Initializes trackball rotation:- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the MouseEvent
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
Ends trackball rotation:- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the MouseEvent
-
mouseWheelMoved
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
- Specified by:
mouseWheelMoved
in interfacejava.awt.event.MouseWheelListener
-
OnDisplay
public void OnDisplay()
OnDisplay callback, called when the application window is displayed.- Overrides:
OnDisplay
in classJavaApplication
-
OnInitialize
public boolean OnInitialize()
OnInitialize callback, called when the application is created.- Overrides:
OnInitialize
in classJavaApplication
- Returns:
- true
-
OnTerminate
public void OnTerminate()
OnTerminate callback, called when the application terminates.- Overrides:
OnTerminate
in classJavaApplication
-
setCameraLocation
public void setCameraLocation(Vector3f v)
Set the camera location.- Parameters:
v
- camera position vector
-
setCameraParameters
public void setCameraParameters(float[] newCameraParams)
Get the camera parameters for move and turn.
-
setObjectRotation
public void setObjectRotation(Matrix3f rot)
Set the object rotation matrix- Parameters:
rot
- rotation matrix
-
setObjectParameters
public void setObjectParameters(float[] newObjectParams)
Get the object rotation parameters ( roll, pitch, yaw )
-
DrawFrameRate
protected void DrawFrameRate(int iX, int iY, ColorRGBA rkColor)
Performance measurement: Draws the frame rate on screen- Parameters:
iX
- the x-position for drawing the frame rateiY
- the y-position for drawing the frame raterkColor
- the text color
-
UpdateCameraTranslationSpeed
protected void UpdateCameraTranslationSpeed(float fTrnSpeed)
update camera translation speed- Parameters:
fTrnSpeed
- camera translation speed
-
UpdateCameraRotationSpeed
protected void UpdateCameraRotationSpeed(float fRotSpeed)
update camera rotation speed- Parameters:
fRotSpeed
- camera rotation speed
-
UpdateCameraZoomSpeed
protected void UpdateCameraZoomSpeed(float fZoomSpeed)
update camera zoom speed- Parameters:
fRotSpeed
- camera zoom speed
-
UpdateMouseRotationSpeed
protected void UpdateMouseRotationSpeed(float fRotSpeed)
update camera rotation speed- Parameters:
fRotSpeed
- mouse rotation speed
-
InitializeCameraMotion
protected void InitializeCameraMotion(float fTrnSpeed, float fRotSpeed)
Initialize Camera Motion- Parameters:
fTrnSpeed
- camera translation speedfRotSpeed
- camera rotation speed
-
InitializeCameraMotion
protected void InitializeCameraMotion(float fTrnSpeed, float fRotSpeed, float fTrnSpeedFactor, float fRotSpeedFactor)
Initialize Camera Motion- Parameters:
fTrnSpeed
- camera translation speedfRotSpeed
- camera rotation speedfTrnSpeedFactor
- camera translation speed factorfRotSpeedFactor
- camera rotation speed factor
-
InitializeObjectMotion
protected void InitializeObjectMotion(Spatial pkMotionObject)
Initializes Object Motion
-
LookDown
protected void LookDown()
Causes the camera to look down.
-
LookUp
protected void LookUp()
Causes the camera to look up.
-
MeasureTime
protected void MeasureTime()
Performance measurement: Measure time
-
MoveBackward
protected void MoveBackward()
Moves the camera backward.
-
MoveCamera
protected boolean MoveCamera()
Camera Motion- Returns:
- true when the camera has moved, false if the camera has not moved
-
MoveDown
protected void MoveDown()
Moves the camera down.
-
MoveForward
protected void MoveForward()
Moves the camera forward.
-
MoveLeft
protected void MoveLeft()
Moves the camera left.
-
MoveObject
protected boolean MoveObject()
Moves object.- Returns:
- true when the object has moved, false otherwise.
-
MoveRight
protected void MoveRight()
Moves the camera right.
-
MoveUp
protected void MoveUp()
Moves the camera up.
-
ResetTime
protected void ResetTime()
Performance measurement: Resets time
-
RotateTrackBall
protected void RotateTrackBall(float fX0, float fY0, float fX1, float fY1)
Rotate the the object with a virtual trackball- Parameters:
fX0
- start mouse x-positionfY0
- start mouse y-positionfX1
- end mouse x-positionfY1
- end mouse y-position
-
TurnLeft
protected void TurnLeft()
Turns the camera left.
-
TurnRight
protected void TurnRight()
Turns the camera right.
-
UpdateFrameCount
protected void UpdateFrameCount()
Performance measurement: Update frame count
-
-