40 #ifndef _cameracontroller_cpp
41 #define _cameracontroller_cpp
43 #include "cameracontroller.h"
47 #include "rayquerytool.h"
48 #include "worldmanager.h"
49 #include "worldobject.h"
52 #include "MathTools/mathtools.h"
69 Controlled(ToBeControlled),
89 Real Pi = MathTools::GetPi();
91 Angle = -Pi + (Angle - Pi);
92 }
else if( Angle < -Pi ) {
93 Angle = Pi + (Angle + Pi);
142 Ray GroundRay(Loc,Dest);
143 UInt32 flags = Mezzanine::WO_MeshTerrain | Mezzanine::WO_HeightfieldTerrain | Mezzanine::WO_VectorFieldTerrain | Mezzanine::WO_VoxelTerrain;
283 Quaternion CamRot = YawQuat * PitchQuat * RollQuat;
void CheckAllAngles()
Calls CheckAngleLimits() and CheckAngleRollover(Real).
Real Lower
The lower limit for rotation, in radians.
Real FindDistanceToGround()
Performs a raycast to get the distance to any terrain beneath the camera.
virtual void SetOrientation(const Quaternion &Ori)
Sets the orientation of this object in parent space.
virtual Vector3 GetLocation() const
Gets this objects current location.
Real HoverHeight
The height at which the camera is to remain above the terrain.
MovementMode
Possible options for determining how the camera should move relative to the world.
AngleLimits * RollLimits
A pointer to the angle limits for rotations on the Z axis.
Graphics::CameraProxy * GetControlledCamera() const
Gets the camera this controller is controlling.
Real YawRad
The current rotation of the camera on the Y axis.
virtual WorldManager * GetCreator() const
Gets a pointer to this proxies creator.
Any global enumerations shared between multiple classes is to be declared here.
CameraController()
Blank constructor.
Real RollRad
The current rotation of the camera on the Z axis.
void SetControlledCamera(Graphics::CameraProxy *ToBeControlled)
Sets the camera being controlled by this controller.
void SetYawLimits(const Real &UpperLimit, const Real &LowerLimit)
Sets rotational limits on the Y axis.
float Real
A Datatype used to represent a real floating point number.
void CheckHeight()
Ensures the camera position is at the desired height above any world terrain.
virtual World * GetWorld() const
Gets the world this manager belongs to.
void MoveBackward(Real Units)
Moves the camera backward.
Real Upper
The upper limit for rotation, in radians.
virtual Quaternion GetOrientation() const
Gets this objects current orientation.
void CheckAngleRollover(Real Angle)
Wraps an angle value if it goes outside the range of [-pi,+pi].
This file contains the declaration for the World proxy wrapping camera functionality.
void RemoveYawLimits()
Clears any set limits on yaw(Y axis) rotation.
uint32_t UInt32
An 32-bit unsigned integer.
void Rotate(Real Yaw, Real Pitch, Real Roll)
Rotates the camera.
MovementMode GetMovementMode() const
Gets the currently set movement mode.
static Vector3 Unit_Y()
Gets a vector representing the Y unit of a Vector3.
~CameraController()
Class destructor.
void RemoveRollLimits()
Clears any set limits on roll(Z axis) rotation.
void StrafeRight(Real Units)
Moves the camera to the right.
MovementMode CurrentMMode
The mode with which the camera should move around the scene.
void SetRollLimits(const Real &UpperLimit, const Real &LowerLimit)
Sets rotational limits on the Z axis.
AngleLimits * YawLimits
A pointer to the angle limits for rotations on the Y axis.
static Vector3 Unit_X()
Gets a vector representing the X unit of a Vector3.
This is the proxy class for placing and manipulating a camera in the scene.
CCM_Walk: This forces the camera to be only a certain distance above the terrain. ...
void MoveForward(Real Units)
Moves the camera forward.
static Vector3 Unit_Z()
Gets a vector representing the Z unit of a Vector3.
void SetPitchLimits(const Real &UpperLimit, const Real &LowerLimit)
Sets rotational limits on the X axis.
Real GetHoverHeight() const
Gets the distance the camera hovers over terrain while in CCM_Walk mode.
This is used to represent a point in space, or a vector through space.
void SetHoverHeight(const Real &Hover)
Sets the hover distance for the camera while it's moving.
The bulk of the engine components go in this namspace.
Real PitchRad
The current rotation of the camera on the X axis.
void CheckAngleLimits()
Clamps all current rotation values to their set limits.
void SetMovementMode(const MovementMode &MoveMode)
Sets the movement mode for this camera/controller.
virtual void SetLocation(const Vector3 &Loc)
Sets the location of this object in parent space.
RayQueryTool RayCaster
A ray casting tool used to determine surrounding geometry to limit movement.
This is used to store information about rotation in 3d space.
AngleLimits * PitchLimits
A pointer to the angle limits for rotations on the X axis.
Boundaries for rotation on one axis.
void Rotate6DOF(Real Yaw, Real Pitch, Real Roll)
Rotates the camera.
void RemovePitchLimits()
Clears any set limits on pitch(X axis) rotation.
virtual void MoveRelative(const Vector3 &ToMove)
Moves the camera through local space.
void StrafeLeft(Real Units)
Moves the camera to the left.
This represents a line placed in 3D space and is used with spacial queries.
static Vector3 Neg_Unit_Y()
Gets a vector representing the negative Y unit of a Vector3.
Graphics::CameraProxy * Controlled
A pointer to the Camera being controlled.