1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/openmw/mwrender/player.hpp

99 lines
2.2 KiB
C++
Raw Normal View History

#ifndef GAME_MWRENDER_PLAYER_H
#define GAME_MWRENDER_PLAYER_H
#include <string>
2011-02-10 12:56:19 +01:00
namespace Ogre
2012-08-12 18:35:35 +04:00
{
class Vector3;
class Camera;
class SceneNode;
}
namespace MWWorld
{
class Ptr;
}
namespace MWRender
{
2012-08-14 20:33:29 +04:00
class NpcAnimation;
/// \brief Player character rendering and camera control
class Player
{
2012-08-14 02:36:18 +04:00
struct CamData {
float pitch, yaw, offset;
};
Ogre::Camera *mCamera;
2012-08-12 15:50:37 +04:00
Ogre::SceneNode *mPlayerNode;
Ogre::SceneNode *mCameraNode;
2012-08-14 02:36:18 +04:00
Ogre::SceneNode *mVanityNode;
2012-08-14 20:33:29 +04:00
NpcAnimation *mAnimation;
bool mFirstPersonView;
2012-08-12 15:50:37 +04:00
bool mPreviewMode;
2012-08-14 14:37:48 +04:00
struct {
bool enabled, allowed, forced;
} mVanity;
float mHeight, mCameraDistance;
2012-08-14 02:36:18 +04:00
CamData mMainCam, mPreviewCam;
2012-08-12 18:35:35 +04:00
2012-08-12 15:50:37 +04:00
float mTimeIdle;
2012-08-12 18:35:35 +04:00
int mUpdates;
/// Updates sound manager listener data
void updateListener();
2012-08-13 08:37:32 +04:00
void rotateCamera(const Ogre::Vector3 &rot, bool adjust);
2012-08-12 18:35:35 +04:00
2012-08-14 02:36:18 +04:00
float getYaw();
void setYaw(float angle);
float getPitch();
void setPitch(float angle);
2012-08-12 15:50:37 +04:00
2012-08-14 14:37:48 +04:00
void moveCameraNode(Ogre::SceneNode *node);
public:
Player (Ogre::Camera *camera, Ogre::SceneNode* mNode);
/// Set where the player is looking at. Uses Morrowind (euler) angles
2012-08-11 13:23:54 +04:00
/// \param rot Rotation angles in radians
/// \return true if player object needs to bo rotated physically
2012-08-12 15:50:37 +04:00
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 &);
2011-02-10 12:56:19 +01:00
2012-08-12 15:50:37 +04:00
void toggleViewMode();
2012-08-14 14:37:48 +04:00
bool toggleVanityMode(bool enable, bool force = false);
void allowVanityMode(bool allow);
2012-08-12 15:50:37 +04:00
2012-08-14 02:36:18 +04:00
void togglePreviewMode(bool enable);
2012-08-12 15:50:37 +04:00
void update(float duration);
2012-08-14 14:37:48 +04:00
void setCameraDistance(float dist, bool adjust = false);
2012-08-14 20:33:29 +04:00
void setAnimation(MWRender::NpcAnimation *anim) {
mAnimation = anim;
}
void setHeight(float height);
float getHeight();
};
}
#endif