com.threerings.opengl.camera
Class CameraHandler

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

public abstract class CameraHandler
extends Object
implements Renderer.Observer

Controls the camera parameters.


Nested Class Summary
static interface CameraHandler.Offset
          Provides a means of temporarily offsetting the camera transform.
 
Constructor Summary
CameraHandler(GlContext ctx)
          Creates a new camera handler for the compositor camera.
CameraHandler(GlContext ctx, Camera camera, boolean matchRenderSurface)
          Creates a new camera handler for the specified camera.
 
Method Summary
 void addOffset(CameraHandler.Offset offset)
          Adds an element to the list of offsets to apply.
 float getFar()
          Returns the distance to the far clip plane.
 float getFieldOfView()
          Returns the camera's field of view in radians.
 float getNear()
          Returns the distance to the near clip plane.
 Quaternion getViewerRotation()
          Returns a reference to the rotation to use for the viewer.
 Vector3f getViewerTranslation()
          Returns a reference to the translation to use for the notional "viewer."
 boolean isAdded()
          Determines whether the camera handler is currently active.
 void setPerspective(float fovy, float near, float far)
          Sets the camera's perspective parameters.
 void sizeChanged(int width, int height)
          Notes that the size of the renderer's drawable surface has changed.
 void updatePerspective()
          Updates the camera perspective parameters.
 void updatePosition()
          Updates the camera position.
 void wasAdded()
          Notifies the handler that it has been added.
 void wasRemoved()
          Notifies the handler that it has been removed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CameraHandler

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


CameraHandler

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

Parameters:
matchRenderSurface - if true, automatically adjust the camera viewport to match the dimensions of the renderer surface.
Method Detail

setPerspective

public void setPerspective(float fovy,
                           float near,
                           float far)
Sets the camera's perspective parameters.


getFieldOfView

public float getFieldOfView()
Returns the camera's field of view in radians.


getNear

public float getNear()
Returns the distance to the near clip plane.


getFar

public float getFar()
Returns the distance to the far clip plane.


addOffset

public void addOffset(CameraHandler.Offset offset)
Adds an element to the list of offsets to apply.


getViewerTranslation

public Vector3f getViewerTranslation()
Returns a reference to the translation to use for the notional "viewer."


getViewerRotation

public Quaternion getViewerRotation()
Returns a reference to the rotation to use for the viewer.


isAdded

public boolean isAdded()
Determines whether the camera handler is currently active.


wasAdded

public void wasAdded()
Notifies the handler that it has been added.


wasRemoved

public void wasRemoved()
Notifies the handler that it has been removed.


updatePerspective

public void updatePerspective()
Updates the camera perspective parameters.


updatePosition

public void updatePosition()
Updates the camera position.


sizeChanged

public void sizeChanged(int width,
                        int height)
Description copied from interface: Renderer.Observer
Notes that the size of the renderer's drawable surface has changed.

Specified by:
sizeChanged in interface Renderer.Observer


Copyright © 2011. All Rights Reserved.