Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends

Camera Class Reference

#include <Camera.h>

Inheritance diagram for Camera:
Transformable Node

List of all members.

Public Member Functions

void setOrthogonalProjection (f32 left, f32 right, f32 bottom, f32 top, f32 nnear, f32 nfar)
void setPerspectiveProjection (f32 fovy, f32 aspect, f32 nnear, f32 nfar)
void setProjection (mat4f &matrix)
vec3f unproject (vec3f screen_coord)
mat4f getProjectionMatrix () const
mat4f getProjectionMatrixInverse ()
mat4f getViewMatrix ()
mat4f getViewMatrixInverse ()
mat4f getViewProjectionMatrix ()
mat4f getViewProjectionMatrixInverse ()
void calculateFrustum (vec4f frustum[6])
void toggleIndicator (bool visible)
bool getIndicator ()
void logInfo ()

Static Public Member Functions

static void registerCommands ()

Protected Member Functions

 Camera (const char *nname)

Friends

class SceneGraph
class World

Detailed Description

Defines a Camera node.


Member Function Documentation

void Camera::setOrthogonalProjection ( f32  left,
f32  right,
f32  bottom,
f32  top,
f32  nnear,
f32  nfar 
)

Set orthogonal projection

This sets the camera matrix to:

[ 2 / (left - right) 0 0 tx ; 0 2 / (top - bottom) 0 ty ; 0 0 2 / (nfar - nnear) tz ; 0 0 0 1 ]

tx = (right + left) / (right - left) ty = (top + bottom) / (top - bottom) tz = (nfar + nnear) / (nfar - nnear)

void Camera::setPerspectiveProjection ( f32  fovy,
f32  aspect,
f32  nnear,
f32  nfar 
)

Set perspective projection

This sets the camera matrix to: [ f / aspect 0 0 0 ; 0 f 0 0 ; 0 0 g h ; 0 0 -1 0 ]

f = cot(fovy / 2) g = (nfar + nnear) / (nnear - nfar) h = (2 * nfar * nnear) / (nnear - nfar)

Parameters:
fovyField of view in radians
aspecty / x
void Camera::setProjection ( mat4f matrix )

Set projection matrix

This makes projection inverse computation much slower than for perspective or orthogonal matrices, since they are very easy to invert.

void Camera::toggleIndicator ( bool  visible )

Enable/disable light indicator for debugging purposes

vec3f Camera::unproject ( vec3f  screen_coord )

Unproject a screen coordinate

Parameters:
screen_coordValues should lie within [-1, 1]. Set Z to -1 for near plane and 1 for far plane.
Returns:
A point in world space

The documentation for this class was generated from the following files:
 All Classes Functions