Public Member Functions | Protected Member Functions | Protected Attributes
ogre_tools::FPSCamera Class Reference

A first-person camera, controlled by yaw, pitch, and position. More...

#include <fps_camera.h>

Inheritance diagram for ogre_tools::FPSCamera:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FPSCamera (Ogre::SceneManager *scene_manager)
virtual void fromString (const std::string &str)
 Loads the camera's configure from the supplied string (generated through toString())
virtual Ogre::Quaternion getOrientation ()
 Get the orientation of this camera.
float getPitch ()
virtual Ogre::Vector3 getPosition ()
 Get the position of this camera.
float getYaw ()
virtual void lookAt (const Ogre::Vector3 &point)
 Point the camera at the specified point.
virtual void mouseLeftDrag (int diff_x, int diff_y, bool ctrl, bool alt, bool shift)
 Handle a left mouse button drag.
virtual void mouseMiddleDrag (int diff_x, int diff_y, bool ctrl, bool alt, bool shift)
 Handle a middle mouse button drag.
virtual void mouseRightDrag (int diff_x, int diff_y, bool ctrl, bool alt, bool shift)
 Handle a right mouse button drag.
virtual void move (float x, float y, float z)
 Move the camera relative to its orientation.
virtual void pitch (float angle)
 Pitch the camera.
virtual void relativeNodeChanged ()
 Called when the relative node changes.
virtual void roll (float angle)
 Roll the camera.
virtual void scrollWheel (int diff, bool ctrl, bool alt, bool shift)
 Handle a scrollwheel change.
virtual void setFrom (CameraBase *camera)
 Set the position/orientation of this camera from another camera.
virtual void setOrientation (float x, float y, float z, float w)
 Set the orientation of the camera from a quaternion.
virtual void setPosition (float x, float y, float z)
 Set the position of the camera.
virtual std::string toString ()
 Returns a string representation of the camera's configuration.
virtual void yaw (float angle)
 Yaw the camera.
virtual ~FPSCamera ()

Protected Member Functions

void normalizePitch ()
 Normalizes the camera's pitch, preventing it from turning upside down.
void normalizeYaw ()
 Normalizes yaw in the range [0, 2*pi)
void update ()
 Sets the camera's orientation based on pitch_ and yaw_.

Protected Attributes

float pitch_
 Pitch of the camera (rotation around the x-axis), in radians.
float yaw_
 Yaw of the camera (rotation around the y-axis), in radians.

Detailed Description

A first-person camera, controlled by yaw, pitch, and position.

Definition at line 49 of file fps_camera.h.


Constructor & Destructor Documentation

FPSCamera::FPSCamera ( Ogre::SceneManager *  scene_manager)

Definition at line 47 of file fps_camera.cpp.

FPSCamera::~FPSCamera ( ) [virtual]

Definition at line 54 of file fps_camera.cpp.


Member Function Documentation

void FPSCamera::fromString ( const std::string &  str) [virtual]

Loads the camera's configure from the supplied string (generated through toString())

Parameters:
strThe string to load from

Implements ogre_tools::CameraBase.

Definition at line 214 of file fps_camera.cpp.

Ogre::Quaternion FPSCamera::getOrientation ( ) [virtual]

Get the orientation of this camera.

Returns:
The orientation of this camera

Implements ogre_tools::CameraBase.

Definition at line 162 of file fps_camera.cpp.

float ogre_tools::FPSCamera::getPitch ( ) [inline]

Definition at line 55 of file fps_camera.h.

Ogre::Vector3 FPSCamera::getPosition ( ) [virtual]

Get the position of this camera.

Returns:
The position of this camera

Implements ogre_tools::CameraBase.

Definition at line 179 of file fps_camera.cpp.

float ogre_tools::FPSCamera::getYaw ( ) [inline]

Definition at line 56 of file fps_camera.h.

void FPSCamera::lookAt ( const Ogre::Vector3 &  point) [virtual]

Point the camera at the specified point.

Parameters:
pointThe point to look at

Implements ogre_tools::CameraBase.

Definition at line 184 of file fps_camera.cpp.

void FPSCamera::mouseLeftDrag ( int  diff_x,
int  diff_y,
bool  ctrl,
bool  alt,
bool  shift 
) [virtual]

Handle a left mouse button drag.

Parameters:
diff_xPixels the mouse has moved in the (window space) x direction
diff_yPixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 193 of file fps_camera.cpp.

void FPSCamera::mouseMiddleDrag ( int  diff_x,
int  diff_y,
bool  ctrl,
bool  alt,
bool  shift 
) [virtual]

Handle a middle mouse button drag.

Parameters:
diff_xPixels the mouse has moved in the (window space) x direction
diff_yPixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 199 of file fps_camera.cpp.

void FPSCamera::mouseRightDrag ( int  diff_x,
int  diff_y,
bool  ctrl,
bool  alt,
bool  shift 
) [virtual]

Handle a right mouse button drag.

Parameters:
diff_xPixels the mouse has moved in the (window space) x direction
diff_yPixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 204 of file fps_camera.cpp.

void FPSCamera::move ( float  x,
float  y,
float  z 
) [virtual]

Move the camera relative to its orientation.

Parameters:
xDistance to move along the X-axis
yDistance to move along the Y-axis
zDistance to move along the Z-axis

Implements ogre_tools::CameraBase.

Definition at line 167 of file fps_camera.cpp.

void FPSCamera::normalizePitch ( ) [protected]

Normalizes the camera's pitch, preventing it from turning upside down.

Definition at line 76 of file fps_camera.cpp.

void FPSCamera::normalizeYaw ( ) [protected]

Normalizes yaw in the range [0, 2*pi)

Definition at line 88 of file fps_camera.cpp.

void FPSCamera::pitch ( float  angle) [virtual]

Pitch the camera.

Calls to pitch are cumulative, so: pitch(PI); pitch(PI);

is equivalent to pitch(2*PI);

Parameters:
angleAngle to pitch, in radians

Implements ogre_tools::CameraBase.

Definition at line 107 of file fps_camera.cpp.

void FPSCamera::relativeNodeChanged ( ) [virtual]

Called when the relative node changes.

Reimplemented from ogre_tools::CameraBase.

Definition at line 58 of file fps_camera.cpp.

void FPSCamera::roll ( float  angle) [virtual]

Roll the camera.

Calls to roll are cumulative, so: roll(PI); roll(PI);

is equivalent to roll(2*PI);

Parameters:
angleAngle to roll, in radians

Implements ogre_tools::CameraBase.

Definition at line 116 of file fps_camera.cpp.

void FPSCamera::scrollWheel ( int  diff,
bool  ctrl,
bool  alt,
bool  shift 
) [virtual]

Handle a scrollwheel change.

Parameters:
diffNumber of "units" the scrollwheel has moved
Todo:
Probably need to pass in how many units there are in a "click" of the wheel

Implements ogre_tools::CameraBase.

Definition at line 209 of file fps_camera.cpp.

void FPSCamera::setFrom ( CameraBase camera) [virtual]

Set the position/orientation of this camera from another camera.

Parameters:
cameraThe camera to set from

Implements ogre_tools::CameraBase.

Definition at line 120 of file fps_camera.cpp.

void FPSCamera::setOrientation ( float  x,
float  y,
float  z,
float  w 
) [virtual]

Set the orientation of the camera from a quaternion.

Implements ogre_tools::CameraBase.

Definition at line 126 of file fps_camera.cpp.

void FPSCamera::setPosition ( float  x,
float  y,
float  z 
) [virtual]

Set the position of the camera.

Implements ogre_tools::CameraBase.

Definition at line 174 of file fps_camera.cpp.

std::string FPSCamera::toString ( ) [virtual]

Returns a string representation of the camera's configuration.

Implements ogre_tools::CameraBase.

Definition at line 235 of file fps_camera.cpp.

void FPSCamera::update ( ) [protected, virtual]

Sets the camera's orientation based on pitch_ and yaw_.

Implements ogre_tools::CameraBase.

Definition at line 66 of file fps_camera.cpp.

void FPSCamera::yaw ( float  angle) [virtual]

Yaw the camera.

Calls to yaw are cumulative, so: yaw(PI); yaw(PI);

is equivalent to yaw(2*PI);

Parameters:
angleAngle to yaw, in radians

Implements ogre_tools::CameraBase.

Definition at line 98 of file fps_camera.cpp.


Member Data Documentation

float ogre_tools::FPSCamera::pitch_ [protected]

Pitch of the camera (rotation around the x-axis), in radians.

Definition at line 94 of file fps_camera.h.

float ogre_tools::FPSCamera::yaw_ [protected]

Yaw of the camera (rotation around the y-axis), in radians.

Definition at line 95 of file fps_camera.h.


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


ogre_tools_qt
Author(s): Josh Faust
autogenerated on Fri Dec 6 2013 20:56:43