MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::CameraController Class Reference

This is a simplified controller class for use with cameras. More...

#include <cameracontroller.h>

+ Collaboration diagram for Mezzanine::CameraController:

Public Types

enum  MovementMode { CCM_Fly, CCM_Walk }
 Possible options for determining how the camera should move relative to the world. More...
 

Public Member Functions

 CameraController (Graphics::CameraProxy *ToBeControlled)
 Class constructor. More...
 
 ~CameraController ()
 Class destructor.
 
Graphics::CameraProxyGetControlledCamera () const
 Gets the camera this controller is controlling. More...
 
Real GetHoverHeight () const
 Gets the distance the camera hovers over terrain while in CCM_Walk mode. More...
 
MovementMode GetMovementMode () const
 Gets the currently set movement mode. More...
 
void MoveBackward (Real Units)
 Moves the camera backward. More...
 
void MoveForward (Real Units)
 Moves the camera forward. More...
 
void RemovePitchLimits ()
 Clears any set limits on pitch(X axis) rotation.
 
void RemoveRollLimits ()
 Clears any set limits on roll(Z axis) rotation.
 
void RemoveYawLimits ()
 Clears any set limits on yaw(Y axis) rotation.
 
void Rotate (Real Yaw, Real Pitch, Real Roll)
 Rotates the camera. More...
 
void Rotate6DOF (Real Yaw, Real Pitch, Real Roll)
 Rotates the camera. More...
 
void SetHoverHeight (const Real &Hover)
 Sets the hover distance for the camera while it's moving. More...
 
void SetMovementMode (const MovementMode &MoveMode)
 Sets the movement mode for this camera/controller. More...
 
void SetPitchLimits (const Real &UpperLimit, const Real &LowerLimit)
 Sets rotational limits on the X axis. More...
 
void SetRollLimits (const Real &UpperLimit, const Real &LowerLimit)
 Sets rotational limits on the Z axis. More...
 
void SetYawLimits (const Real &UpperLimit, const Real &LowerLimit)
 Sets rotational limits on the Y axis. More...
 
void StrafeLeft (Real Units)
 Moves the camera to the left. More...
 
void StrafeRight (Real Units)
 Moves the camera to the right. More...
 

Protected Member Functions

void CheckAllAngles ()
 
void CheckAngleLimits ()
 
void CheckAngleRollover (Real Angle)
 
void CheckHeight ()
 
Real FindDistanceToGround ()
 

Protected Attributes

Graphics::CameraProxyControlled
 
MovementMode CurrentMMode
 
Real HoverHeight
 
AngleLimitsPitchLimits
 
Real PitchRad
 
RayQueryTool RayCaster
 
AngleLimitsRollLimits
 
Real RollRad
 
AngleLimitsYawLimits
 
Real YawRad
 

Detailed Description

This is a simplified controller class for use with cameras.

This class is useful for manipulating cameras to move around in simple ways, such as flying through a scene.

Definition at line 68 of file cameracontroller.h.

Member Enumeration Documentation

Possible options for determining how the camera should move relative to the world.

Enumerator
CCM_Fly 

CCM_Fly: This is the default option for every Camera Controller. Allows the camera unrestrained movement throughout the scene.

CCM_Walk 

CCM_Walk: This forces the camera to be only a certain distance above the terrain.

Definition at line 73 of file cameracontroller.h.

Constructor & Destructor Documentation

Mezzanine::CameraController::CameraController ( Graphics::CameraProxy ToBeControlled)

Class constructor.

Parameters
ToBeControlledThe camera this controller is controlling.

Definition at line 53 of file cameracontroller.cpp.

Member Function Documentation

Graphics::CameraProxy * Mezzanine::CameraController::GetControlledCamera ( ) const

Gets the camera this controller is controlling.

Returns
Returns a camera pointer for the camera this controller is applied to.

Definition at line 138 of file cameracontroller.cpp.

Real Mezzanine::CameraController::GetHoverHeight ( ) const

Gets the distance the camera hovers over terrain while in CCM_Walk mode.

Returns
Returns a Real represening the distance above terrain the camera is to hover, in world units.

Definition at line 161 of file cameracontroller.cpp.

CameraController::MovementMode Mezzanine::CameraController::GetMovementMode ( ) const

Gets the currently set movement mode.

Returns
Returns an enum value representing the current movement mode. See MovementMode enum for more info.

Definition at line 151 of file cameracontroller.cpp.

void Mezzanine::CameraController::MoveBackward ( Real  Units)

Moves the camera backward.

Parameters
UnitsThe distance to be moved in world units.

Definition at line 228 of file cameracontroller.cpp.

void Mezzanine::CameraController::MoveForward ( Real  Units)

Moves the camera forward.

Parameters
UnitsThe distance to be moved in world units.

Definition at line 220 of file cameracontroller.cpp.

void Mezzanine::CameraController::Rotate ( Real  Yaw,
Real  Pitch,
Real  Roll 
)

Rotates the camera.

This is a safer rotation method that applies all the checks and can lock behaviors such as roll if configured to do so.

Parameters
YawThe amount to rotate the camera on it's local Y axis in Radians.
PitchThe amount to rotate the camera on it's local X axis in Radians.
RollThe amount to rotate the camera on it's local Z axis in Radians.

Definition at line 252 of file cameracontroller.cpp.

void Mezzanine::CameraController::Rotate6DOF ( Real  Yaw,
Real  Pitch,
Real  Roll 
)

Rotates the camera.

This is a freeform rotation method that will apply the rotation desired to the camera without any checks. This is ideal for spacecraft style controls.

Parameters
YawThe amount to rotate the camera on it's local Y axis in Radians.
PitchThe amount to rotate the camera on it's local X axis in Radians.
RollThe amount to rotate the camera on it's local Z axis in Radians.

Definition at line 279 of file cameracontroller.cpp.

void Mezzanine::CameraController::SetHoverHeight ( const Real Hover)

Sets the hover distance for the camera while it's moving.

Hover is only applied in CCM_Walk mode. Default: 1.0.

Parameters
HoverThe distance above the ground to hover, in world units.

Definition at line 156 of file cameracontroller.cpp.

void Mezzanine::CameraController::SetMovementMode ( const MovementMode MoveMode)

Sets the movement mode for this camera/controller.

Parameters
MoveModeThe MovementMode value for which mode you want applied. See MovementMode enum for more info.

Definition at line 146 of file cameracontroller.cpp.

void Mezzanine::CameraController::SetPitchLimits ( const Real UpperLimit,
const Real LowerLimit 
)

Sets rotational limits on the X axis.

The rotation range is from -Pi to Pi.

Parameters
UpperLimitThe allowed upper rotation limit in radians.
LowerLimitThe allowed upper rotation limit in radians.

Definition at line 183 of file cameracontroller.cpp.

void Mezzanine::CameraController::SetRollLimits ( const Real UpperLimit,
const Real LowerLimit 
)

Sets rotational limits on the Z axis.

The rotation range is from -Pi to Pi.

Parameters
UpperLimitThe allowed upper rotation limit in radians.
LowerLimitThe allowed upper rotation limit in radians.

Definition at line 200 of file cameracontroller.cpp.

void Mezzanine::CameraController::SetYawLimits ( const Real UpperLimit,
const Real LowerLimit 
)

Sets rotational limits on the Y axis.

The rotation range is from -Pi to Pi.

Parameters
UpperLimitThe allowed upper rotation limit in radians.
LowerLimitThe allowed lower rotation limit in radians.

Definition at line 166 of file cameracontroller.cpp.

void Mezzanine::CameraController::StrafeLeft ( Real  Units)

Moves the camera to the left.

Parameters
UnitsThe distance to be moved in world units.

Definition at line 236 of file cameracontroller.cpp.

void Mezzanine::CameraController::StrafeRight ( Real  Units)

Moves the camera to the right.

Parameters
UnitsThe distance to be moved in world units.

Definition at line 244 of file cameracontroller.cpp.


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