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

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

Definition at line 36 of file fps_camera.cpp.

ogre_tools::FPSCamera::~FPSCamera (  )  [virtual]

Definition at line 43 of file fps_camera.cpp.


Member Function Documentation

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

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

Parameters:
str The string to load from

Implements ogre_tools::CameraBase.

Definition at line 203 of file fps_camera.cpp.

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

Get the orientation of this camera.

Returns:
The orientation of this camera

Implements ogre_tools::CameraBase.

Definition at line 151 of file fps_camera.cpp.

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

Definition at line 55 of file fps_camera.h.

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

Get the position of this camera.

Returns:
The position of this camera

Implements ogre_tools::CameraBase.

Definition at line 168 of file fps_camera.cpp.

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

Definition at line 56 of file fps_camera.h.

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

Point the camera at the specified point.

Parameters:
point The point to look at

Implements ogre_tools::CameraBase.

Definition at line 173 of file fps_camera.cpp.

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

Handle a left mouse button drag.

Parameters:
diff_x Pixels the mouse has moved in the (window space) x direction
diff_y Pixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 182 of file fps_camera.cpp.

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

Handle a middle mouse button drag.

Parameters:
diff_x Pixels the mouse has moved in the (window space) x direction
diff_y Pixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 188 of file fps_camera.cpp.

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

Handle a right mouse button drag.

Parameters:
diff_x Pixels the mouse has moved in the (window space) x direction
diff_y Pixels the mouse has moved in the (window space) y direction

Implements ogre_tools::CameraBase.

Definition at line 193 of file fps_camera.cpp.

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

Move the camera relative to its orientation.

Parameters:
x Distance to move along the X-axis
y Distance to move along the Y-axis
z Distance to move along the Z-axis

Implements ogre_tools::CameraBase.

Definition at line 156 of file fps_camera.cpp.

void ogre_tools::FPSCamera::normalizePitch (  )  [protected]

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

Definition at line 65 of file fps_camera.cpp.

void ogre_tools::FPSCamera::normalizeYaw (  )  [protected]

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

Definition at line 77 of file fps_camera.cpp.

void ogre_tools::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:
angle Angle to pitch, in radians

Implements ogre_tools::CameraBase.

Definition at line 96 of file fps_camera.cpp.

void ogre_tools::FPSCamera::relativeNodeChanged (  )  [virtual]

Called when the relative node changes.

Reimplemented from ogre_tools::CameraBase.

Definition at line 47 of file fps_camera.cpp.

void ogre_tools::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:
angle Angle to roll, in radians

Implements ogre_tools::CameraBase.

Definition at line 105 of file fps_camera.cpp.

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

Handle a scrollwheel change.

Parameters:
diff Number 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 198 of file fps_camera.cpp.

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

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

Parameters:
camera The camera to set from

Implements ogre_tools::CameraBase.

Definition at line 109 of file fps_camera.cpp.

void ogre_tools::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 115 of file fps_camera.cpp.

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

Set the position of the camera.

Implements ogre_tools::CameraBase.

Definition at line 163 of file fps_camera.cpp.

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

Returns a string representation of the camera's configuration.

Implements ogre_tools::CameraBase.

Definition at line 224 of file fps_camera.cpp.

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

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

Implements ogre_tools::CameraBase.

Definition at line 55 of file fps_camera.cpp.

void ogre_tools::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:
angle Angle to yaw, in radians

Implements ogre_tools::CameraBase.

Definition at line 87 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines


ogre_tools
Author(s): Josh Faust
autogenerated on Fri Jan 11 09:10:16 2013