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[]cameraParamsCamera parameters.protected Vector3f[]m_akWorldAxiscamera motion parametersprotected booleanm_bCameraMoveableflag indicating the camera is movableprotected booleanm_bDArrowPressedflag indicating the down arrow was pressedprotected booleanm_bEndPressedflag indicating the end key was pressedprotected booleanm_bHomePressedflag indicating the home key was pressedprotected booleanm_bLArrowPressedflag indicating the left arrow was pressedprotected booleanm_bLInsertPressedflag indicating the insert key was pressed.protected booleanm_bObjectZoomedTrackball rotation flags:protected booleanm_bPgDnPressedflag indicating page down was pressedprotected booleanm_bPgUpPressedflag indicating page up was pressedprotected booleanm_bRArrowPressedflag indicating the right arrow was pressedprotected booleanm_bRDeletePressedflag indicating the delete key was pressed.protected booleanm_bTrackBallDownTrackball rotation flags:protected booleanm_bUArrowPressedflag indicating the up arrow was pressedprotected booleanm_bUseTrackBallTrackball rotation flags:protected doublem_dAccumulatedTimeFrame-rate Performance parameters:protected doublem_dFrameRateFrame-rate Performance parameters:protected doublem_dLastTimeFrame-rate Performance parameters:protected floatm_fRotSpeedRotation speedprotected floatm_fRotSpeedFactorIncrease/Decrease rotation speed factorprotected floatm_fTrnSpeedTranslation speedprotected floatm_fTrnSpeedFactorIncrease/Decrease translation speed factorprotected floatm_fXDrag0Drag xy pixel coordinates:protected floatm_fXTrack0Trackball start and end xy pixel coordinates:protected floatm_fXTrack1Trackball start and end xy pixel coordinates:protected floatm_fYDrag0Drag xy pixel coordinates:protected floatm_fYTrack0Trackball start and end xy pixel coordinates:protected floatm_fYTrack1Trackball start and end xy pixel coordinates:protected floatm_fZoomSpeedZoom speedprotected intm_iAccumulatedFrameCountFrame-rate Performance parameters:protected intm_iDoPitchRoll, yaw, pitch:protected intm_iDoRollRoll, yaw, pitch:protected intm_iDoYawRoll, yaw, pitch:protected intm_iFrameCountFrame-rate Performance parameters:protected intm_iMaxTimerFrame-rate Performance parameters:protected intm_iMouseButtonThe last button on the mouse to be pressed/releasedprotected intm_iTimerFrame-rate Performance parameters:protected Matrix3fm_kSaveRotateCurrent rotation, saved during trackball rotate:protected floatm_mouseRotSpeedmouse control rotation speedprotected Cameram_spkCameraCamera object.protected Spatialm_spkMotionObjectObject rotation node:private float[]objectParamsObject rotation parameters.protected floatpitchRotationAngleRoll, yaw, pitch rotation angleprotected floatrollRotationAngleRoll, yaw, pitch rotation angleprivate static longserialVersionUIDprotected floatxCameraMoveMove the camera right or left.protected floatxCameraTurnTurn the camera left or right.protected floatyawRotationAngleRoll, yaw, pitch rotation angleprotected floatyCameraMoveMove the camera up or down.protected floatyCameraTurnTurn the camera to up or down.protected floatzCameraMoveMove 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 voiddispose()Delete memory.protected voidDrawFrameRate(int iX, int iY, ColorRGBA rkColor)Performance measurement: Draws the frame rate on screenVector3fgetCameraLocation()Get the camera current locationfloat[]getCameraParameters()Get the camera parameters for move and turn.float[]getObjectParameters()Get the object rotation parameters ( roll, pitch, yaw )Matrix3fgetObjectRotation()Get the object rotation matrix.protected voidInitializeCameraMotion(float fTrnSpeed, float fRotSpeed)Initialize Camera Motionprotected voidInitializeCameraMotion(float fTrnSpeed, float fRotSpeed, float fTrnSpeedFactor, float fRotSpeedFactor)Initialize Camera Motionprotected voidInitializeObjectMotion(Spatial pkMotionObject)Initializes Object MotionvoidkeyPressed(java.awt.event.KeyEvent kKey)keyPressed callback.voidkeyReleased(java.awt.event.KeyEvent kKey)keyReleased callback.voidkeyTyped(java.awt.event.KeyEvent e)protected voidLookDown()Causes the camera to look down.protected voidLookUp()Causes the camera to look up.protected voidMeasureTime()Performance measurement: Measure timevoidmouseClicked(java.awt.event.MouseEvent e)User input: stubvoidmouseDragged(java.awt.event.MouseEvent e)Rotates the object with a virtual trackball:voidmouseEntered(java.awt.event.MouseEvent e)User input: stubvoidmouseExited(java.awt.event.MouseEvent e)User input: stubvoidmouseMoved(java.awt.event.MouseEvent e)User input: stubvoidmousePressed(java.awt.event.MouseEvent e)Initializes trackball rotation:voidmouseReleased(java.awt.event.MouseEvent e)Ends trackball rotation:voidmouseWheelMoved(java.awt.event.MouseWheelEvent e)protected voidMoveBackward()Moves the camera backward.protected booleanMoveCamera()Camera Motionprotected voidMoveDown()Moves the camera down.protected voidMoveForward()Moves the camera forward.protected voidMoveLeft()Moves the camera left.protected booleanMoveObject()Moves object.protected voidMoveRight()Moves the camera right.protected voidMoveUp()Moves the camera up.voidOnDisplay()OnDisplay callback, called when the application window is displayed.booleanOnInitialize()OnInitialize callback, called when the application is created.voidOnTerminate()OnTerminate callback, called when the application terminates.protected voidResetTime()Performance measurement: Resets timeprotected voidRotateTrackBall(float fX0, float fY0, float fX1, float fY1)Rotate the the object with a virtual trackballvoidsetCameraLocation(Vector3f v)Set the camera location.voidsetCameraParameters(float[] newCameraParams)Get the camera parameters for move and turn.voidsetObjectParameters(float[] newObjectParams)Get the object rotation parameters ( roll, pitch, yaw )voidsetObjectRotation(Matrix3f rot)Set the object rotation matrixprotected voidTurnLeft()Turns the camera left.protected voidTurnRight()Turns the camera right.protected voidUpdateCameraRotationSpeed(float fRotSpeed)update camera rotation speedprotected voidUpdateCameraTranslationSpeed(float fTrnSpeed)update camera translation speedprotected voidUpdateCameraZoomSpeed(float fZoomSpeed)update camera zoom speedprotected voidUpdateFrameCount()Performance measurement: Update frame countprotected voidUpdateMouseRotationSpeed(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:
disposein 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:
keyPressedin interfacejava.awt.event.KeyListener- Overrides:
keyPressedin classJavaApplication- Parameters:
kKey- the KeyEvent triggering the callback.
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent kKey)
keyReleased callback.- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener- Overrides:
keyReleasedin classJavaApplication- Parameters:
kKey- the KeyEvent triggering the callback.
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener- Overrides:
keyTypedin classJavaApplication
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseClickedin 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:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Parameters:
e- the MouseEvent
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener- Parameters:
e- the MouseEvent
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener- Parameters:
e- the MouseEvent
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
User input: stub- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Parameters:
e- the MouseEvent
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
Initializes trackball rotation:- Specified by:
mousePressedin interfacejava.awt.event.MouseListener- Parameters:
e- the MouseEvent
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
Ends trackball rotation:- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener- Parameters:
e- the MouseEvent
-
mouseWheelMoved
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
- Specified by:
mouseWheelMovedin interfacejava.awt.event.MouseWheelListener
-
OnDisplay
public void OnDisplay()
OnDisplay callback, called when the application window is displayed.- Overrides:
OnDisplayin classJavaApplication
-
OnInitialize
public boolean OnInitialize()
OnInitialize callback, called when the application is created.- Overrides:
OnInitializein classJavaApplication- Returns:
- true
-
OnTerminate
public void OnTerminate()
OnTerminate callback, called when the application terminates.- Overrides:
OnTerminatein 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
-
-