mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 06:49:55 +00:00
84 lines
2.2 KiB
C++
84 lines
2.2 KiB
C++
#ifndef GAME_MWVR_VRCAMERA_H
|
|
#define GAME_MWVR_VRCAMERA_H
|
|
|
|
#include <string>
|
|
|
|
#include <osg/ref_ptr>
|
|
#include <osg/Vec3>
|
|
#include <osg/Vec3d>
|
|
#include <osg/Quat>
|
|
|
|
#include "../mwrender/camera.hpp"
|
|
|
|
#include "vrtypes.hpp"
|
|
|
|
namespace MWVR
|
|
{
|
|
/// \brief VR camera control
|
|
class VRCamera : public MWRender::Camera
|
|
{
|
|
public:
|
|
|
|
VRCamera(osg::Camera* camera);
|
|
~VRCamera() override;
|
|
|
|
/// Update the view matrix of \a cam
|
|
void updateCamera(osg::Camera* cam) override;
|
|
|
|
/// Update the view matrix of the current camera
|
|
void updateCamera() override;
|
|
|
|
/// Reset to defaults
|
|
void reset() override;
|
|
|
|
/// Set where the camera is looking at. Uses Morrowind (euler) angles
|
|
/// \param rot Rotation angles in radians
|
|
void rotateCamera(float pitch, float roll, float yaw, bool adjust) override;
|
|
|
|
float getRoll() const { return mRoll; }
|
|
void setRoll(float angle);
|
|
|
|
void toggleViewMode(bool force = false) override;
|
|
|
|
bool toggleVanityMode(bool enable) override;
|
|
void allowVanityMode(bool allow) override;
|
|
|
|
/// Stores focal and camera world positions in passed arguments
|
|
void getPosition(osg::Vec3d& focal, osg::Vec3d& camera) const override;
|
|
|
|
/// Store camera orientation in passed arguments
|
|
void getOrientation(osg::Quat& orientation) const override;
|
|
|
|
void processViewChange() override;
|
|
|
|
void rotateCameraToTrackingPtr() override;
|
|
|
|
osg::Quat stageRotation();
|
|
|
|
void rotateStage(float yaw) { mYawOffset += yaw; }
|
|
|
|
void requestRecenter() { mShouldRecenter = true; }
|
|
|
|
const osg::Vec3& headOffset() const { return mHeadOffset; }
|
|
|
|
void setHeadOffset(const osg::Vec3& headOffset) { mHeadOffset = headOffset; }
|
|
|
|
void setShouldTrackPlayerCharacter(bool track);
|
|
|
|
protected:
|
|
void recenter();
|
|
void applyTracking();
|
|
void updateTracking();
|
|
|
|
private:
|
|
float mRoll = 0.f;
|
|
Pose mHeadPose{};
|
|
osg::Vec3 mHeadOffset{ 0,0,0 };
|
|
bool mShouldRecenter{ true };
|
|
bool mHasTrackingData{ false };
|
|
float mYawOffset{ 0.f };
|
|
bool mShouldTrackPlayerCharacter{ false };
|
|
};
|
|
}
|
|
|
|
#endif
|