com.threerings.opengl.camera
Class OrbitCameraHandler

java.lang.Object
  extended by com.threerings.opengl.camera.CameraHandler
      extended by com.threerings.opengl.camera.OrbitCameraHandler
All Implemented Interfaces:
Renderer.Observer

public class OrbitCameraHandler
extends CameraHandler

Swings the camera around a target position.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.opengl.camera.CameraHandler
CameraHandler.Offset
 
Field Summary
protected  SphereCoords _coords
          The coordinates relative to the target.
protected  float _maxDistance
          The minimum and maximum distances.
protected  float _maxElevation
          The minimum and maximum elevations.
protected  float _minDistance
          The minimum and maximum distances.
protected  float _minElevation
          The minimum and maximum elevations.
protected  Vector3f _pan
          A temporary vector for pan calculations.
protected  Vector3f _target
          The location that the camera is looking at.
 
Fields inherited from class com.threerings.opengl.camera.CameraHandler
_camera, _ctx, _far, _fovy, _matchRenderSurface, _near, _offsets
 
Constructor Summary
OrbitCameraHandler(GlContext ctx)
          Creates a new orbit camera handler for the compositor camera.
OrbitCameraHandler(GlContext ctx, Camera camera, boolean matchRenderSurface)
          Creates a new orbit camera handler for the specified camera.
 
Method Summary
 SphereCoords getCoords()
          Returns a reference to the camera's coordinates relative to the target.
 Vector3f getTarget()
          Returns a reference to the location of the camera's target.
protected  void getTransform(Transform3D transform)
          Computes the base (pre-offset) camera transform.
 Vector3f getViewerTranslation()
          Returns a reference to the translation to use for the notional "viewer."
 void orbit(float azimuth, float elevation)
          Adjusts the azimuth and elevation of the camera by the specified amounts.
 void pan(float x, float y)
          Pans the target by the specified amounts relative to the camera's current orientation.
 void panXY(float x, float y)
          Pans the target on the XY plane by the specified amounts relative to the camera's current orientation.
 void setCoordLimits(float minElevation, float maxElevation, float minDistance, float maxDistance)
          Sets the limits on the camera's relative coordinates.
 void zoom(float distance)
          "Zooms" in (if negative) or out (if positive) by the specified amount.
 
Methods inherited from class com.threerings.opengl.camera.CameraHandler
addOffset, getFar, getFieldOfView, getNear, getViewerRotation, isAdded, setPerspective, sizeChanged, updatePerspective, updatePosition, wasAdded, wasRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_target

protected Vector3f _target
The location that the camera is looking at.


_coords

protected SphereCoords _coords
The coordinates relative to the target.


_minElevation

protected float _minElevation
The minimum and maximum elevations.


_maxElevation

protected float _maxElevation
The minimum and maximum elevations.


_minDistance

protected float _minDistance
The minimum and maximum distances.


_maxDistance

protected float _maxDistance
The minimum and maximum distances.


_pan

protected Vector3f _pan
A temporary vector for pan calculations.

Constructor Detail

OrbitCameraHandler

public OrbitCameraHandler(GlContext ctx)
Creates a new orbit camera handler for the compositor camera.


OrbitCameraHandler

public OrbitCameraHandler(GlContext ctx,
                          Camera camera,
                          boolean matchRenderSurface)
Creates a new orbit camera handler for the specified camera.

Method Detail

getTarget

public Vector3f getTarget()
Returns a reference to the location of the camera's target.


getCoords

public SphereCoords getCoords()
Returns a reference to the camera's coordinates relative to the target.


orbit

public void orbit(float azimuth,
                  float elevation)
Adjusts the azimuth and elevation of the camera by the specified amounts.


zoom

public void zoom(float distance)
"Zooms" in (if negative) or out (if positive) by the specified amount.


pan

public void pan(float x,
                float y)
Pans the target by the specified amounts relative to the camera's current orientation.


panXY

public void panXY(float x,
                  float y)
Pans the target on the XY plane by the specified amounts relative to the camera's current orientation.


setCoordLimits

public void setCoordLimits(float minElevation,
                           float maxElevation,
                           float minDistance,
                           float maxDistance)
Sets the limits on the camera's relative coordinates.


getViewerTranslation

public Vector3f getViewerTranslation()
Description copied from class: CameraHandler
Returns a reference to the translation to use for the notional "viewer."

Overrides:
getViewerTranslation in class CameraHandler

getTransform

protected void getTransform(Transform3D transform)
Description copied from class: CameraHandler
Computes the base (pre-offset) camera transform.

Specified by:
getTransform in class CameraHandler