Propane::Camera Class Reference

Basic GL camera class that uses quaternions for internal rotation. More...

#include <PropaneCamera.h>

List of all members.

Public Member Functions

float * getMatrix ()
 Return the 4x4 matrix that this camera represents.
float * getInverseMatrix ()
 Get inverse matrix of quaternion Get the "inverse" matrix of the quaternion, which you can use to do things like get the forward vector and a lot of screen space manipulations.
void setPerspective ()
 Tell OpenGL to set our view on the world, using getMatrix. It will apply any pitch/heading/roll changes you have made to the aggregate quaternion, and then reset the 'temporary' variables used.
Vector3 getForwardVector ()
 Get the forward vector of the camera.
float changePitch (float angle)
 Change the pitch ("nodding" rotation").
float changeYaw (float angle)
 Change the yaw ("shaking your head" rotation).
float changeRoll (float angle)
 Change the roll ("barrel roll" rotation).
void reset ()
 Reset temporary yaw/pitch/roll.
 Camera ()
 Default constructor.
Quaternion getAggregate () const
 Get the aggregate quaternion.
void setPosition (const Vector3 &newPosition)
 Reset the position of the camera.
void moveForward (float magnitude)
 Move the camera "forward" by a set amount.


Detailed Description

Basic GL camera class that uses quaternions for internal rotation.

This is vaguely based on the Quaternion camera from NeHe, except mine works.

Examples:

CameraExample.cpp.


Constructor & Destructor Documentation

Propane::Camera::Camera  )  [inline]
 

Default constructor.

It will set the yaw, pitch and roll to 0, and the camera's position to (0,0,0).


Member Function Documentation

float Propane::Camera::changePitch float  angle  )  [inline]
 

Change the pitch ("nodding" rotation").

The camera will not update the internal quaternion until you call setPerspective or getForwardVector.

Parameters:
angle The new angle of pitch, in degrees.
Returns:
The aggregate angle of pitch.
Examples:
CameraExample.cpp.

float Propane::Camera::changeRoll float  angle  )  [inline]
 

Change the roll ("barrel roll" rotation).

The camera will not update the internal quaternion until you call setPerspective or getForwardVector.

Parameters:
angle The new angle of roll, in degrees.
Returns:
The aggregate angle of roll.

float Propane::Camera::changeYaw float  angle  )  [inline]
 

Change the yaw ("shaking your head" rotation).

The camera will not update the internal quaternion until you call setPerspective or getForwardVector.

Parameters:
angle The new angle of yaw, in degrees.
Returns:
The aggregate angle of yaw.

Quaternion Propane::Camera::getAggregate  )  const [inline]
 

Get the aggregate quaternion.

You can use the aggregate quaternion for quaternion math, or for saving and reloading later.

Returns:
The Quaternion this camera uses internally.
Examples:
CameraExample.cpp.

Vector3 Propane::Camera::getForwardVector  )  [inline]
 

Get the forward vector of the camera.

This is the vector the camera is pointing in the general direction of; you can use this to "move in the direction" you are looking by adding it to your position. See moveForward for a method that handles this automatically.

It will apply any pitch/roll/heading changes and reset the related temporary variables.

Returns:
The 3D vector of magnitude 1 representing the forward direction of the camera.
Examples:
CameraExample.cpp.

float* Propane::Camera::getInverseMatrix  )  [inline]
 

Get inverse matrix of quaternion Get the "inverse" matrix of the quaternion, which you can use to do things like get the forward vector and a lot of screen space manipulations.

Returns:
a 4x4 raw matrix suitable for transforming vectors.

float* Propane::Camera::getMatrix  )  [inline]
 

Return the 4x4 matrix that this camera represents.

Returns:
a 4x4 matrix suitable for glMultMatrixf

void Propane::Camera::moveForward float  magnitude  )  [inline]
 

Move the camera "forward" by a set amount.

Parameters:
magnitude The amount to move forward, in units. This will end up as the magnitude of our forward vector.
Examples:
CameraExample.cpp.

void Propane::Camera::reset  )  [inline]
 

Reset temporary yaw/pitch/roll.

setPerspective and getForwardVector call this method automatically, so it is provided as a convenience.

It will reset the temporary yaw, pitch and roll variables.

void Propane::Camera::setPerspective  )  [inline]
 

Tell OpenGL to set our view on the world, using getMatrix. It will apply any pitch/heading/roll changes you have made to the aggregate quaternion, and then reset the 'temporary' variables used.

It will then multiply the matrix represented by the quaternion into the current OpenGL state, and apply the translation indicated by the camera's position vector.

Examples:
CameraExample.cpp.

void Propane::Camera::setPosition const Vector3 &  newPosition  )  [inline]
 

Reset the position of the camera.

Parameters:
newPosition The new location of the camera in 3D
Examples:
CameraExample.cpp.


The documentation for this class was generated from the following file:
Generated on Sun Jan 14 16:49:12 2007 for Propane Injector by  doxygen 1.4.6