This is a simplified controller class for use with cameras. More...
#include <cameracontroller.h>
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::CameraProxy * | GetControlledCamera () 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::CameraProxy * | Controlled |
MovementMode | CurrentMMode |
Real | HoverHeight |
AngleLimits * | PitchLimits |
Real | PitchRad |
RayQueryTool | RayCaster |
AngleLimits * | RollLimits |
Real | RollRad |
AngleLimits * | YawLimits |
Real | YawRad |
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.
Possible options for determining how the camera should move relative to the world.
Definition at line 73 of file cameracontroller.h.
Mezzanine::CameraController::CameraController | ( | Graphics::CameraProxy * | ToBeControlled) |
Class constructor.
ToBeControlled | The camera this controller is controlling. |
Definition at line 53 of file cameracontroller.cpp.
Graphics::CameraProxy * Mezzanine::CameraController::GetControlledCamera | ( | ) | const |
Gets the camera this controller is controlling.
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.
Definition at line 161 of file cameracontroller.cpp.
CameraController::MovementMode Mezzanine::CameraController::GetMovementMode | ( | ) | const |
Gets the currently set movement mode.
Definition at line 151 of file cameracontroller.cpp.
void Mezzanine::CameraController::MoveBackward | ( | Real | Units) |
Moves the camera backward.
Units | The 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.
Units | The distance to be moved in world units. |
Definition at line 220 of file cameracontroller.cpp.
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.
Yaw | The amount to rotate the camera on it's local Y axis in Radians. |
Pitch | The amount to rotate the camera on it's local X axis in Radians. |
Roll | The amount to rotate the camera on it's local Z axis in Radians. |
Definition at line 252 of file cameracontroller.cpp.
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.
Yaw | The amount to rotate the camera on it's local Y axis in Radians. |
Pitch | The amount to rotate the camera on it's local X axis in Radians. |
Roll | The 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.
Hover | The 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.
MoveMode | The 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.
UpperLimit | The allowed upper rotation limit in radians. |
LowerLimit | The 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.
UpperLimit | The allowed upper rotation limit in radians. |
LowerLimit | The allowed upper rotation limit in radians. |
Definition at line 200 of file cameracontroller.cpp.
Sets rotational limits on the Y axis.
The rotation range is from -Pi to Pi.
UpperLimit | The allowed upper rotation limit in radians. |
LowerLimit | The 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.
Units | The 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.
Units | The distance to be moved in world units. |
Definition at line 244 of file cameracontroller.cpp.