2011-01-08 14:11:37 +00:00
|
|
|
#ifndef GAME_MWRENDER_PLAYER_H
|
|
|
|
#define GAME_MWRENDER_PLAYER_H
|
|
|
|
|
2012-07-03 13:32:38 +00:00
|
|
|
#include <string>
|
2011-02-10 11:56:19 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
|
2011-01-08 14:11:37 +00:00
|
|
|
namespace Ogre
|
2012-08-08 20:15:52 +00:00
|
|
|
{
|
|
|
|
class Vector3;
|
2011-01-08 14:11:37 +00:00
|
|
|
class Camera;
|
2012-07-03 13:32:38 +00:00
|
|
|
class SceneNode;
|
2011-01-08 14:11:37 +00:00
|
|
|
}
|
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
|
|
|
|
2011-01-08 14:11:37 +00:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
/// \brief Player character rendering and camera control
|
|
|
|
class Player
|
|
|
|
{
|
|
|
|
Ogre::Camera *mCamera;
|
2011-11-17 02:15:49 +00:00
|
|
|
Ogre::SceneNode* mNode;
|
2011-01-08 14:11:37 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
bool mFirstPersonView;
|
|
|
|
bool mVanityModeEnabled;
|
|
|
|
|
2012-08-11 10:54:33 +00:00
|
|
|
float controlFlip(float shift = 0.f);
|
2012-08-11 08:13:16 +00:00
|
|
|
|
|
|
|
/// Updates sound manager listener data
|
2012-08-09 13:01:03 +00:00
|
|
|
void updateListener();
|
2012-08-09 06:24:18 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
Player (Ogre::Camera *camera, Ogre::SceneNode* mNode);
|
|
|
|
|
|
|
|
/// Set where the player is looking at. Uses Morrowind (euler) angles
|
2012-08-11 09:23:54 +00:00
|
|
|
/// \param rot Rotation angles in radians
|
2012-08-11 08:13:16 +00:00
|
|
|
/// \return true if player object needs to bo rotated physically
|
2012-08-08 20:15:52 +00:00
|
|
|
bool setRotation(const Ogre::Vector3 &rot);
|
2012-08-11 08:13:16 +00:00
|
|
|
|
2012-08-11 09:23:54 +00:00
|
|
|
/// \param rot Rotation angles in radians
|
2012-08-11 08:13:16 +00:00
|
|
|
/// \return true if player object needs to bo rotated physically
|
2012-08-08 20:15:52 +00:00
|
|
|
bool adjustRotation(const Ogre::Vector3 &rot);
|
2011-01-08 14:11:37 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
std::string getHandle() const;
|
2011-01-08 14:11:37 +00:00
|
|
|
|
2012-08-11 08:13:16 +00:00
|
|
|
/// Attach camera to object
|
|
|
|
/// \note there is no protection from attaching the same camera to
|
|
|
|
/// several different objects
|
2012-08-08 20:15:52 +00:00
|
|
|
void attachTo(const MWWorld::Ptr &);
|
2011-02-10 11:56:19 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
void toggleViewMode() {
|
|
|
|
mFirstPersonView = !mFirstPersonView;
|
|
|
|
}
|
2012-05-30 13:52:39 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
void toggleVanityMode() {
|
|
|
|
mVanityModeEnabled = !mVanityModeEnabled;
|
|
|
|
}
|
2011-01-08 14:11:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|