com.threerings.opengl.camera
Class Camera

java.lang.Object
  extended by com.threerings.opengl.camera.Camera

public class Camera
extends Object

Contains the camera state.


Constructor Summary
Camera()
           
 
Method Summary
 void apply(Renderer renderer)
          Applies the camera state to the specified renderer.
 float getBottom()
          Returns the location of the bottom edge of the view frustum at the near plane.
 void getCenterRay(Ray3D result)
          Populates the supplied object with a ray through the center of the viewport.
 float getFar()
          Returns the distance to the far clip plane.
 float getLeft()
          Returns the location of the left edge of the view frustum at the near plane.
 float getNear()
          Returns the distance to the near clip plane.
 Vector3f getNearFarNormal()
          Returns a reference to the normal of the near/far clip planes.
 void getPickRay(int x, int y, Ray3D result)
          Populates the supplied object with a ray through the specified viewport coordinates.
 Matrix4f getProjection()
          Returns a reference to the projection matrix.
 float getRight()
          Returns the location of the right edge of the view frustum at the near plane.
 void getTexGenPlanes(Vector4f s, Vector4f t, Vector4f q)
          Populates the supplied vectors with texture coordinate generation planes corresponding to the camera projection state.
 float getTop()
          Returns the location of the top edge of the view frustum at the near plane.
 Rectangle getViewport()
          Returns a reference to the camera viewport.
 Transform3D getViewTransform()
          Returns a reference to the camera view transform (the inverse of the world transform).
 Transform3D getWorldTransform()
          Returns a reference to the camera's current transform in world space.
 Frustum getWorldVolume()
          Returns a reference to the volume that the camera occupies in the world.
 boolean isMirrored()
          Determines whether or not the camera is mirrored.
 boolean isOrtho()
          Determines whether or not the camera is set to an orthographic projection.
 void setFrustum(float left, float right, float bottom, float top, float near, float far)
          Sets the camera frustum parameters.
 void setOrtho(float left, float right, float bottom, float top, float near, float far)
          Sets the camera frustum parameters.
 void setPerspective(float fovy, float aspect, float near, float far)
          Sets the camera perspective parameters.
 void setProjection(Camera ocamera)
          Copies the projection parameters of another camera.
 void setProjection(float left, float right, float bottom, float top, float near, float far, Vector3f nearFarNormal, boolean ortho, boolean mirrored)
          Sets the camera projection parameters.
 Box transform(Box box)
          Transforms and projects a box in world space into window space.
 Box transform(Box box, Box result)
          Transforms and projects a box in world space into window space, placing the result in the object provided.
 Vector3f transform(Vector3f point)
          Transforms and projects a point in world space into window space.
 Vector3f transform(Vector3f point, Vector3f result)
          Transforms and projects a point in world space into window space, placing the result in the object provided.
 Box transformLocal(Box box)
          Transforms and projects a box in world space into window space.
 Vector3f transformLocal(Vector3f point)
          Transforms and projects a point in world space into window space.
 void updateTransform()
          Updates the camera transform.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Camera

public Camera()
Method Detail

getWorldTransform

public Transform3D getWorldTransform()
Returns a reference to the camera's current transform in world space.


getViewTransform

public Transform3D getViewTransform()
Returns a reference to the camera view transform (the inverse of the world transform).


getWorldVolume

public Frustum getWorldVolume()
Returns a reference to the volume that the camera occupies in the world.


getViewport

public Rectangle getViewport()
Returns a reference to the camera viewport.


setPerspective

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


setFrustum

public void setFrustum(float left,
                       float right,
                       float bottom,
                       float top,
                       float near,
                       float far)
Sets the camera frustum parameters.


setOrtho

public void setOrtho(float left,
                     float right,
                     float bottom,
                     float top,
                     float near,
                     float far)
Sets the camera frustum parameters.


setProjection

public void setProjection(Camera ocamera)
Copies the projection parameters of another camera.


setProjection

public void setProjection(float left,
                          float right,
                          float bottom,
                          float top,
                          float near,
                          float far,
                          Vector3f nearFarNormal,
                          boolean ortho,
                          boolean mirrored)
Sets the camera projection parameters.


getProjection

public Matrix4f getProjection()
Returns a reference to the projection matrix.


getLeft

public float getLeft()
Returns the location of the left edge of the view frustum at the near plane.


getRight

public float getRight()
Returns the location of the right edge of the view frustum at the near plane.


getBottom

public float getBottom()
Returns the location of the bottom edge of the view frustum at the near plane.


getTop

public float getTop()
Returns the location of the top edge of the view frustum at the near plane.


getNear

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


getFar

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


getNearFarNormal

public Vector3f getNearFarNormal()
Returns a reference to the normal of the near/far clip planes.


isOrtho

public boolean isOrtho()
Determines whether or not the camera is set to an orthographic projection.


isMirrored

public boolean isMirrored()
Determines whether or not the camera is mirrored.


updateTransform

public void updateTransform()
Updates the camera transform.


apply

public void apply(Renderer renderer)
Applies the camera state to the specified renderer.


transformLocal

public Box transformLocal(Box box)
Transforms and projects a box in world space into window space.

Returns:
a reference to the box, for chaining.

transform

public Box transform(Box box)
Transforms and projects a box in world space into window space.

Returns:
a new box containing the result.

transform

public Box transform(Box box,
                     Box result)
Transforms and projects a box in world space into window space, placing the result in the object provided.

Returns:
a reference to the result box, for chaining.

transformLocal

public Vector3f transformLocal(Vector3f point)
Transforms and projects a point in world space into window space.

Returns:
a reference to the point, for chaining.

transform

public Vector3f transform(Vector3f point)
Transforms and projects a point in world space into window space.

Returns:
a new vector containing the result.

transform

public Vector3f transform(Vector3f point,
                          Vector3f result)
Transforms and projects a point in world space into window space, placing the result in the object provided.

Returns:
a reference to the result vector, for chaining.

getTexGenPlanes

public void getTexGenPlanes(Vector4f s,
                            Vector4f t,
                            Vector4f q)
Populates the supplied vectors with texture coordinate generation planes corresponding to the camera projection state.


getCenterRay

public void getCenterRay(Ray3D result)
Populates the supplied object with a ray through the center of the viewport.


getPickRay

public void getPickRay(int x,
                       int y,
                       Ray3D result)
Populates the supplied object with a ray through the specified viewport coordinates.



Copyright © 2011. All Rights Reserved.