1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwrender/player.hpp

89 lines
1.9 KiB
C++
Raw Normal View History

#ifndef GAME_MWRENDER_PLAYER_H
#define GAME_MWRENDER_PLAYER_H
#include <string>
2011-02-10 11:56:19 +00:00
namespace Ogre
2012-08-12 14:35:35 +00:00
{
class Vector3;
class Camera;
class SceneNode;
}
namespace MWWorld
{
class Ptr;
}
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;
};
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;
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;
/// Updates sound manager listener data
void updateListener();
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);
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
/// \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);
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 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-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);
};
}
#endif