1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 02:49:55 +00:00
openmw-tes3mp/apps/openmw/mwrender/player.hpp
2012-08-17 15:19:44 +04:00

96 lines
2.1 KiB
C++

#ifndef GAME_MWRENDER_PLAYER_H
#define GAME_MWRENDER_PLAYER_H
#include <string>
namespace Ogre
{
class Vector3;
class Camera;
class SceneNode;
}
namespace MWWorld
{
class Ptr;
}
namespace MWRender
{
class NpcAnimation;
/// \brief Player character rendering and camera control
class Player
{
struct CamData {
float pitch, yaw, offset;
};
Ogre::Camera *mCamera;
Ogre::SceneNode *mPlayerNode;
Ogre::SceneNode *mCameraNode;
Ogre::SceneNode *mVanityNode;
NpcAnimation *mAnimation;
bool mFirstPersonView;
bool mPreviewMode;
struct {
bool enabled, allowed, forced;
} mVanity;
float mHeight, mCameraDistance;
CamData mMainCam, mPreviewCam;
float mTimeIdle;
int mUpdates;
/// Updates sound manager listener data
void updateListener();
void rotateCamera(const Ogre::Vector3 &rot, bool adjust);
float getYaw();
void setYaw(float angle);
float getPitch();
void setPitch(float angle);
void moveCameraNode(Ogre::SceneNode *node);
public:
Player (Ogre::Camera *camera, Ogre::SceneNode* mNode);
/// Set where the player is looking at. Uses Morrowind (euler) angles
/// \param rot Rotation angles in radians
/// \return true if player object needs to bo rotated physically
bool rotate(const Ogre::Vector3 &rot, bool adjust);
std::string getHandle() const;
/// Attach camera to object
/// \note there is no protection from attaching the same camera to
/// several different objects
void attachTo(const MWWorld::Ptr &);
void toggleViewMode();
bool toggleVanityMode(bool enable, bool force = false);
void allowVanityMode(bool allow);
void togglePreviewMode(bool enable);
void update(float duration);
void setCameraDistance(float dist, bool adjust = false);
void setAnimation(MWRender::NpcAnimation *anim);
void setHeight(float height);
float getHeight();
};
}
#endif