de.javagl.swogl.interaction
Class ArcballCameraBehavior

java.lang.Object
  extended by de.javagl.swogl.interaction.ArcballCameraBehavior

public class ArcballCameraBehavior
extends java.lang.Object

This class controls the movement of a Camera in an Arcball style.

Usually this class will be controlled by a MouseListener/MouseMotionListener/MouseWheelListener by calling the main public methods accordingly:

However, different applications of these methods may be implemented by the client.


Constructor Summary
ArcballCameraBehavior(View view, MutableCamera camera)
          Creates a new ArcballCameraBehavior that uses the given view and camera.
 
Method Summary
 void doArcballRotate(java.awt.Point point)
          Called when the arcball rotation continues to the given point
 void doMovement(java.awt.Point point)
          Called when the movement continues to the given point
 javax.vecmath.Point3f getInitialEyePoint()
          Returns the initial eye point
 float getInitialFovDegrees()
          Return the initial FOV, in degrees
 javax.vecmath.Vector3f getInitialUpVector()
          Returns the initial up vector
 javax.vecmath.Point3f getInitialViewPoint()
          Returns the initial view point
 void reset()
          Reset the camera to its initial configuration
 void setInitialConfiguration(javax.vecmath.Tuple3f eyePoint, javax.vecmath.Tuple3f viewPoint, javax.vecmath.Tuple3f upVector, float fovDegrees)
          Set the configuration that will be established when reset() is called
 void setInitialEyePoint(javax.vecmath.Point3f initialEyePoint)
          Set the initial eye point
 void setInitialFovDegrees(float initialFovDegrees)
          Set the initial FOV, in degrees
 void setInitialUpVector(javax.vecmath.Vector3f initialUpVector)
          Set the initial up vector
 void setInitialViewPoint(javax.vecmath.Point3f initialViewPoint)
          Set the initial view point
 void startArcballRotate(java.awt.Point point)
          Called when the arcball rotation starts at the given point
 void startMovement(java.awt.Point point)
          Called when the movement starts at the given point
 void zoom(float amount)
          Zoom by the given amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArcballCameraBehavior

public ArcballCameraBehavior(View view,
                             MutableCamera camera)
Creates a new ArcballCameraBehavior that uses the given view and camera. The initial configuration of this behavior (which will be established upon a call to reset()) will be obtained from the current configuration of the given camera.

Parameters:
view - The view
camera - The camera
Method Detail

setInitialConfiguration

public void setInitialConfiguration(javax.vecmath.Tuple3f eyePoint,
                                    javax.vecmath.Tuple3f viewPoint,
                                    javax.vecmath.Tuple3f upVector,
                                    float fovDegrees)
Set the configuration that will be established when reset() is called

Parameters:
eyePoint - The initial eye point
viewPoint - The initial view point
upVector - The initial up vector
fovDegrees - The FOV in degrees

getInitialEyePoint

public javax.vecmath.Point3f getInitialEyePoint()
Returns the initial eye point

Returns:
the initial eye point

setInitialEyePoint

public void setInitialEyePoint(javax.vecmath.Point3f initialEyePoint)
Set the initial eye point

Parameters:
initialEyePoint - The initial eye point

getInitialViewPoint

public javax.vecmath.Point3f getInitialViewPoint()
Returns the initial view point

Returns:
the initial view point

setInitialViewPoint

public void setInitialViewPoint(javax.vecmath.Point3f initialViewPoint)
Set the initial view point

Parameters:
initialViewPoint - The initial view point

getInitialUpVector

public javax.vecmath.Vector3f getInitialUpVector()
Returns the initial up vector

Returns:
the initial up vector

setInitialUpVector

public void setInitialUpVector(javax.vecmath.Vector3f initialUpVector)
Set the initial up vector

Parameters:
initialUpVector - The initial up vector

getInitialFovDegrees

public float getInitialFovDegrees()
Return the initial FOV, in degrees

Returns:
The initial FOV

setInitialFovDegrees

public void setInitialFovDegrees(float initialFovDegrees)
Set the initial FOV, in degrees

Parameters:
initialFovDegrees - The initial FOV

reset

public void reset()
Reset the camera to its initial configuration


startArcballRotate

public void startArcballRotate(java.awt.Point point)
Called when the arcball rotation starts at the given point

Parameters:
point - The point where the arcball rotation starts, in screen coordinates

doArcballRotate

public void doArcballRotate(java.awt.Point point)
Called when the arcball rotation continues to the given point

Parameters:
point - The current mouse position, screen coordinates

startMovement

public void startMovement(java.awt.Point point)
Called when the movement starts at the given point

Parameters:
point - The point where the movement starts, in screen coordinates

doMovement

public void doMovement(java.awt.Point point)
Called when the movement continues to the given point

Parameters:
point - The current mouse position, screen coordinates

zoom

public void zoom(float amount)
Zoom by the given amount. This will move the eye position towards or away from the view position.

Parameters:
amount - The zoom amount