HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Camera Class Reference

#include <Camera.h>

Public Member Functions

 Camera ()
 
 ~Camera ()
 
Transform Matrices
void setWorldMatrix (const Matrix44 &mat)
 Set the world matrix. More...
 
const Matrix44getWorldMatrix () const
 Return the world matrix. More...
 
void setViewMatrix (const Matrix44 &mat)
 Set the view matrix. More...
 
const Matrix44getViewMatrix () const
 Return the view matrix. More...
 
void setProjectionMatrix (const Matrix44 &mat)
 Set the projection matrix. More...
 
const Matrix44getProjectionMatrix () const
 Return the projection matrix. More...
 
Matrix44 getWorldViewProjMatrix () const
 Compute our full model-view-projection matrix. More...
 
Vector3 getViewPosition () const
 Derive viewer position from the view matrix. More...
 
Vector3 getViewDirection () const
 Derive viewer direction from the view matrix. More...
 
Viewport
void setViewportSize (const Vector2 &size)
 Set the size of the viewport window. More...
 
const Vector2getViewportSize () const
 Return the size of the viewport window. More...
 
Vector3 projectToViewport (Vector3 v)
 Project a position from object to viewport space. More...
 
Vector3 unprojectFromViewport (Vector3 v)
 Unproject a position from viewport to object space. More...
 
Arcball
void arcballButtonEvent (const Vector2 &pos, bool pressed)
 Indicates a button state change, with pos being the instantaneous location of the mouse. More...
 
bool applyArcballMotion (const Vector2 &pos)
 Apply mouse motion to the arcball state. More...
 
Matrix44 arcballMatrix () const
 Return the arcball matrix. More...
 

Static Public Member Functions

static CameraPtr create ()
 Create a new camera. More...
 
Utilities
static Matrix44 createViewMatrix (const Vector3 &eye, const Vector3 &target, const Vector3 &up)
 Create a view matrix given an eye position, a target position and an up vector. More...
 
static Matrix44 createPerspectiveMatrix (float left, float right, float bottom, float top, float nearP, float farP)
 Create a perpective projection matrix given a set of clip planes with [-1,1] projected Z. More...
 
static Matrix44 createOrthographicMatrix (float left, float right, float bottom, float top, float nearP, float farP)
 Create an orthographic projection matrix given a set of clip planes with [-1,1] projected Z. More...
 
static Matrix44 createPerspectiveMatrixZP (float left, float right, float bottom, float top, float nearP, float farP)
 Create a perpective projection matrix given a set of clip planes with [0,1] projected Z. More...
 
static Matrix44 createOrthographicMatrixZP (float left, float right, float bottom, float top, float nearP, float farP)
 Create an orthographic projection matrix given a set of clip planes with [0,1] projected Z. More...
 
static Vector3 transformPointPerspective (const Matrix44 &m, const Vector3 &v)
 

Protected Attributes

Matrix44 _worldMatrix
 
Matrix44 _viewMatrix
 
Matrix44 _projectionMatrix
 
Vector2 _viewportSize
 
bool _arcballActive
 
Vector2 _arcballLastPos
 
Quaternion _arcballQuat
 
Quaternion _arcballDelta
 
float _arcballSpeed
 

Detailed Description

A simple camera class, supporting transform matrices and arcball functionality for object-viewing applications.

Definition at line 19 of file Camera.h.

Constructor & Destructor Documentation

Camera::Camera ( )
inline

Definition at line 22 of file Camera.h.

Camera::~Camera ( )
inline

Definition at line 32 of file Camera.h.

Member Function Documentation

bool Camera::applyArcballMotion ( const Vector2 pos)

Apply mouse motion to the arcball state.

void Camera::arcballButtonEvent ( const Vector2 pos,
bool  pressed 
)

Indicates a button state change, with pos being the instantaneous location of the mouse.

Matrix44 Camera::arcballMatrix ( ) const
inline

Return the arcball matrix.

Definition at line 143 of file Camera.h.

static CameraPtr Camera::create ( )
inlinestatic

Create a new camera.

Definition at line 35 of file Camera.h.

static Matrix44 Camera::createOrthographicMatrix ( float  left,
float  right,
float  bottom,
float  top,
float  nearP,
float  farP 
)
static

Create an orthographic projection matrix given a set of clip planes with [-1,1] projected Z.

static Matrix44 Camera::createOrthographicMatrixZP ( float  left,
float  right,
float  bottom,
float  top,
float  nearP,
float  farP 
)
static

Create an orthographic projection matrix given a set of clip planes with [0,1] projected Z.

static Matrix44 Camera::createPerspectiveMatrix ( float  left,
float  right,
float  bottom,
float  top,
float  nearP,
float  farP 
)
static

Create a perpective projection matrix given a set of clip planes with [-1,1] projected Z.

static Matrix44 Camera::createPerspectiveMatrixZP ( float  left,
float  right,
float  bottom,
float  top,
float  nearP,
float  farP 
)
static

Create a perpective projection matrix given a set of clip planes with [0,1] projected Z.

static Matrix44 Camera::createViewMatrix ( const Vector3 eye,
const Vector3 target,
const Vector3 up 
)
static

Create a view matrix given an eye position, a target position and an up vector.

const Matrix44& Camera::getProjectionMatrix ( ) const
inline

Return the projection matrix.

Definition at line 71 of file Camera.h.

Vector3 Camera::getViewDirection ( ) const
inline

Derive viewer direction from the view matrix.

Definition at line 90 of file Camera.h.

const Matrix44& Camera::getViewMatrix ( ) const
inline

Return the view matrix.

Definition at line 59 of file Camera.h.

const Vector2& Camera::getViewportSize ( ) const
inline

Return the size of the viewport window.

Definition at line 107 of file Camera.h.

Vector3 Camera::getViewPosition ( ) const
inline

Derive viewer position from the view matrix.

Definition at line 83 of file Camera.h.

const Matrix44& Camera::getWorldMatrix ( ) const
inline

Return the world matrix.

Definition at line 47 of file Camera.h.

Matrix44 Camera::getWorldViewProjMatrix ( ) const
inline

Compute our full model-view-projection matrix.

Definition at line 77 of file Camera.h.

Vector3 Camera::projectToViewport ( Vector3  v)
inline

Project a position from object to viewport space.

Definition at line 113 of file Camera.h.

void Camera::setProjectionMatrix ( const Matrix44 mat)
inline

Set the projection matrix.

Definition at line 65 of file Camera.h.

void Camera::setViewMatrix ( const Matrix44 mat)
inline

Set the view matrix.

Definition at line 53 of file Camera.h.

void Camera::setViewportSize ( const Vector2 size)
inline

Set the size of the viewport window.

Definition at line 101 of file Camera.h.

void Camera::setWorldMatrix ( const Matrix44 mat)
inline

Set the world matrix.

Definition at line 41 of file Camera.h.

static Vector3 Camera::transformPointPerspective ( const Matrix44 m,
const Vector3 v 
)
inlinestatic

Apply a perspective transform to the given 3D point, performing a homogeneous divide on the transformed result.

Definition at line 179 of file Camera.h.

Vector3 Camera::unprojectFromViewport ( Vector3  v)
inline

Unproject a position from viewport to object space.

Definition at line 123 of file Camera.h.

Member Data Documentation

bool Camera::_arcballActive
protected

Definition at line 197 of file Camera.h.

Quaternion Camera::_arcballDelta
protected

Definition at line 200 of file Camera.h.

Vector2 Camera::_arcballLastPos
protected

Definition at line 198 of file Camera.h.

Quaternion Camera::_arcballQuat
protected

Definition at line 199 of file Camera.h.

float Camera::_arcballSpeed
protected

Definition at line 201 of file Camera.h.

Matrix44 Camera::_projectionMatrix
protected

Definition at line 191 of file Camera.h.

Matrix44 Camera::_viewMatrix
protected

Definition at line 190 of file Camera.h.

Vector2 Camera::_viewportSize
protected

Definition at line 194 of file Camera.h.

Matrix44 Camera::_worldMatrix
protected

Definition at line 189 of file Camera.h.


The documentation for this class was generated from the following file: