public abstract class Camera
extends java.lang.Object
OrthographicCamera
and PerspectiveCamera
.Modifier and Type  Field and Description 

Matrix4 
combined
the combined projection and view matrix

Vector3 
direction
the unit length direction vector of the camera

float 
far
the far clipping plane distance, has to be positive

Frustum 
frustum
the frustum

Matrix4 
invProjectionView
the inverse combined projection and view matrix

float 
near
the near clipping plane distance, has to be positive

Vector3 
position
the position of the camera

Matrix4 
projection
the projection matrix

Vector3 
up
the unit length up vector of the camera

Matrix4 
view
the view matrix

float 
viewportHeight
the viewport height

float 
viewportWidth
the viewport width

Constructor and Description 

Camera() 
Modifier and Type  Method and Description 

Ray 
getPickRay(float screenX,
float screenY)
Creates a picking
Ray from the coordinates given in screen coordinates. 
Ray 
getPickRay(float screenX,
float screenY,
float viewportX,
float viewportY,
float viewportWidth,
float viewportHeight)
Creates a picking
Ray from the coordinates given in screen coordinates. 
void 
lookAt(float x,
float y,
float z)
Recalculates the direction of the camera to look at the point (x, y, z).

void 
lookAt(Vector3 target)
Recalculates the direction of the camera to look at the point (x, y, z).

void 
normalizeUp()
Normalizes the up vector by first calculating the right vector via a cross product between direction and up, and then
recalculating the up vector via a cross product between right and direction.

Vector3 
project(Vector3 worldCoords)
Projects the
Vector3 given in world space to screen coordinates. 
Vector3 
project(Vector3 worldCoords,
float viewportX,
float viewportY,
float viewportWidth,
float viewportHeight)
Projects the
Vector3 given in world space to screen coordinates. 
void 
rotate(float angle,
float axisX,
float axisY,
float axisZ)
Rotates the direction and up vector of this camera by the given angle around the given axis.

void 
rotate(Matrix4 transform)
Rotates the direction and up vector of this camera by the given rotation matrix.

void 
rotate(Quaternion quat)
Rotates the direction and up vector of this camera by the given
Quaternion . 
void 
rotate(Vector3 axis,
float angle)
Rotates the direction and up vector of this camera by the given angle around the given axis.

void 
rotateAround(Vector3 point,
Vector3 axis,
float angle)
Rotates the direction and up vector of this camera by the given angle around the given axis, with the axis attached to given
point.

void 
transform(Matrix4 transform)
Transform the position, direction and up vector by the given matrix

void 
translate(float x,
float y,
float z)
Moves the camera by the given amount on each axis.

void 
translate(Vector3 vec)
Moves the camera by the given vector.

Vector3 
unproject(Vector3 screenCoords)
Function to translate a point given in screen coordinates to world space.

Vector3 
unproject(Vector3 screenCoords,
float viewportX,
float viewportY,
float viewportWidth,
float viewportHeight)
Function to translate a point given in screen coordinates to world space.

abstract void 
update()
Recalculates the projection and view matrix of this camera and the
Frustum planes. 
abstract void 
update(boolean updateFrustum)
Recalculates the projection and view matrix of this camera and the
Frustum planes if updateFrustum is
true. 
public final Vector3 position
public final Vector3 direction
public final Vector3 up
public final Matrix4 projection
public final Matrix4 view
public final Matrix4 combined
public final Matrix4 invProjectionView
public float near
public float far
public float viewportWidth
public float viewportHeight
public final Frustum frustum
public abstract void update()
Frustum
planes. Use this after you've manipulated
any of the attributes of the camera.public abstract void update(boolean updateFrustum)
Frustum
planes if updateFrustum
is
true. Use this after you've manipulated any of the attributes of the camera.public void lookAt(float x, float y, float z)
x
 the xcoordinate of the point to look aty
 the ycoordinate of the point to look atz
 the zcoordinate of the point to look atpublic void lookAt(Vector3 target)
target
 the point to look atpublic void normalizeUp()
public void rotate(float angle, float axisX, float axisY, float axisZ)
angle
 the angleaxisX
 the xcomponent of the axisaxisY
 the ycomponent of the axisaxisZ
 the zcomponent of the axispublic void rotate(Vector3 axis, float angle)
axis
 the axis to rotate aroundangle
 the anglepublic void rotate(Matrix4 transform)
transform
 The rotation matrixpublic void rotate(Quaternion quat)
Quaternion
. The direction and up vector will not be
orthogonalized.quat
 The quaternionpublic void rotateAround(Vector3 point, Vector3 axis, float angle)
point
 the point to attach the axis toaxis
 the axis to rotate aroundangle
 the anglepublic void transform(Matrix4 transform)
transform
 The transform matrixpublic void translate(float x, float y, float z)
x
 the displacement on the xaxisy
 the displacement on the yaxisz
 the displacement on the zaxispublic void translate(Vector3 vec)
vec
 the displacement vectorpublic Vector3 unproject(Vector3 screenCoords, float viewportX, float viewportY, float viewportWidth, float viewportHeight)
Input
. A zcoordinate of 0 will return a
point on the near plane, a zcoordinate of 1 will return a point on the far plane. This method allows you to specify the
viewport position and dimensions in the coordinate system expected by GL20.glViewport(int, int, int, int)
, with the
origin in the bottom left corner of the screen.screenCoords
 the point in screen coordinates (origin top left)viewportX
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportY
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportWidth
 the width of the viewport in pixelsviewportHeight
 the height of the viewport in pixelsVector3
public Vector3 unproject(Vector3 screenCoords)
Graphics.getWidth()
and
Graphics.getHeight()
. The x and ycoordinate of vec are assumed to be in screen coordinates (origin is the top left
corner, y pointing down, x pointing to the right) as reported by the touch methods in Input
. A zcoordinate of 0
will return a point on the near plane, a zcoordinate of 1 will return a point on the far plane.screenCoords
 the point in screen coordinatesVector3
public Vector3 project(Vector3 worldCoords)
Vector3
given in world space to screen coordinates. It's the same as GLU gluProject with one small
deviation: The viewport is assumed to span the whole screen. The screen coordinate system has its origin in the
bottom left, with the yaxis pointing upwards and the xaxis pointing to the right. This makes it easily
useable in conjunction with Batch
and similar classes.Vector3
public Vector3 project(Vector3 worldCoords, float viewportX, float viewportY, float viewportWidth, float viewportHeight)
Vector3
given in world space to screen coordinates. It's the same as GLU gluProject with one small
deviation: The viewport is assumed to span the whole screen. The screen coordinate system has its origin in the
bottom left, with the yaxis pointing upwards and the xaxis pointing to the right. This makes it easily
useable in conjunction with Batch
and similar classes. This method allows you to specify the viewport position and
dimensions in the coordinate system expected by GL20.glViewport(int, int, int, int)
, with the origin in the bottom
left corner of the screen.viewportX
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportY
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportWidth
 the width of the viewport in pixelsviewportHeight
 the height of the viewport in pixelsVector3
public Ray getPickRay(float screenX, float screenY, float viewportX, float viewportY, float viewportWidth, float viewportHeight)
Ray
from the coordinates given in screen coordinates. It is assumed that the viewport spans the
whole screen. The screen coordinates origin is assumed to be in the top left corner, its yaxis pointing down, the xaxis
pointing to the right. The returned instance is not a new instance but an internal member only accessible via this function.viewportX
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportY
 the coordinate of the bottom left corner of the viewport in glViewport coordinates.viewportWidth
 the width of the viewport in pixelsviewportHeight
 the height of the viewport in pixelspublic Ray getPickRay(float screenX, float screenY)
Ray
from the coordinates given in screen coordinates. It is assumed that the viewport spans the
whole screen. The screen coordinates origin is assumed to be in the top left corner, its yaxis pointing down, the xaxis
pointing to the right. The returned instance is not a new instance but an internal member only accessible via this function.