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
|
|
|
|
2011-01-08 14:11:37 +00:00
|
|
|
namespace Ogre
|
2012-08-12 14:35:35 +00:00
|
|
|
{
|
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
|
|
|
|
{
|
2012-08-13 22:36:18 +00:00
|
|
|
struct CamData {
|
|
|
|
float pitch, yaw, offset;
|
|
|
|
};
|
|
|
|
|
2011-01-08 14:11:37 +00:00
|
|
|
Ogre::Camera *mCamera;
|
2012-08-12 11:50:37 +00:00
|
|
|
|
|
|
|
Ogre::SceneNode *mPlayerNode;
|
|
|
|
Ogre::SceneNode *mCameraNode;
|
2012-08-13 22:36:18 +00:00
|
|
|
Ogre::SceneNode *mVanityNode;
|
2011-01-08 14:11:37 +00:00
|
|
|
|
2012-08-08 20:15:52 +00:00
|
|
|
bool mFirstPersonView;
|
2012-08-12 11:50:37 +00:00
|
|
|
bool mPreviewMode;
|
|
|
|
|
2012-08-14 10:37:48 +00:00
|
|
|
struct {
|
|
|
|
bool enabled, allowed, forced;
|
|
|
|
} mVanity;
|
|
|
|
|
|
|
|
float mHeight, mCameraDistance;
|
2012-08-13 22:36:18 +00:00
|
|
|
CamData mMainCam, mPreviewCam;
|
2012-08-12 14:35:35 +00:00
|
|
|
|
2012-08-12 11:50:37 +00:00
|
|
|
float mTimeIdle;
|
2012-08-12 14:35:35 +00:00
|
|
|
int mUpdates;
|
2012-08-08 20:15:52 +00:00
|
|
|
|
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-13 04:37:32 +00:00
|
|
|
void rotateCamera(const Ogre::Vector3 &rot, bool adjust);
|
2012-08-12 14:35:35 +00:00
|
|
|
|
2012-08-13 22:36:18 +00:00
|
|
|
float getYaw();
|
|
|
|
void setYaw(float angle);
|
|
|
|
|
|
|
|
float getPitch();
|
|
|
|
void setPitch(float angle);
|
2012-08-12 11:50:37 +00:00
|
|
|
|
2012-08-14 10:37:48 +00:00
|
|
|
void moveCameraNode(Ogre::SceneNode *node);
|
|
|
|
|
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-12 11:50:37 +00:00
|
|
|
bool rotate(const Ogre::Vector3 &rot, bool adjust);
|
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-12 11:50:37 +00:00
|
|
|
void toggleViewMode();
|
|
|
|
|
2012-08-14 10:37:48 +00:00
|
|
|
bool toggleVanityMode(bool enable, bool force = false);
|
|
|
|
void allowVanityMode(bool allow);
|
2012-08-12 11:50:37 +00:00
|
|
|
|
2012-08-13 22:36:18 +00:00
|
|
|
void togglePreviewMode(bool enable);
|
2012-05-30 13:52:39 +00:00
|
|
|
|
2012-08-12 11:50:37 +00:00
|
|
|
void update(float duration);
|
2012-08-14 10:37:48 +00:00
|
|
|
|
|
|
|
void setCameraDistance(float dist, bool adjust = false);
|
2011-01-08 14:11:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|