1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 17:19:56 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrinputmanager.hpp

59 lines
1.7 KiB
C++
Raw Normal View History

#ifndef OPENXR_INPUT_MANAGER_HPP
#define OPENXR_INPUT_MANAGER_HPP
2020-02-15 19:01:11 +00:00
#include "openxrviewer.hpp"
#include "../mwinput/inputmanagerimp.hpp"
#include <vector>
#include <array>
#include <iostream>
#include "../mwworld/ptr.hpp"
namespace MWVR
{
2020-02-15 19:01:11 +00:00
struct OpenXRInput;
struct OpenXRActionEvent;
2020-02-15 19:01:11 +00:00
/// As far as I can tell, SDL does not support VR controllers.
/// So I subclass the input manager and insert VR controls.
class OpenXRInputManager : public MWInput::InputManager
{
2020-02-15 19:01:11 +00:00
public:
OpenXRInputManager(
SDL_Window* window,
2020-02-29 22:53:56 +00:00
osg::ref_ptr<osgViewer::Viewer> viewer,
2020-02-15 19:01:11 +00:00
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler,
osgViewer::ScreenCaptureHandler::CaptureOperation* screenCaptureOperation,
const std::string& userFile, bool userFileExists,
const std::string& userControllerBindingsFile,
const std::string& controllerBindingsFile, bool grab);
2020-02-15 19:01:11 +00:00
virtual ~OpenXRInputManager();
2020-02-15 19:01:11 +00:00
/// Overriden to always disallow mouselook and similar.
virtual void changeInputMode(bool guiMode);
2020-02-14 21:11:19 +00:00
2020-02-15 19:01:11 +00:00
/// Overriden to update XR inputs
virtual void update(float dt, bool disableControls = false, bool disableEvents = false);
2020-02-14 21:11:19 +00:00
2020-02-23 10:02:38 +00:00
void updateHead();
2020-02-15 19:01:11 +00:00
void processEvent(const OpenXRActionEvent& event);
PoseSet getHandPoses(int64_t time, TrackedSpace space);
void showActivationIndication(bool show);
2020-02-15 19:01:11 +00:00
std::unique_ptr<OpenXRInput> mXRInput;
2020-02-23 10:02:38 +00:00
Pose mPreviousHeadPose{};
osg::Vec3 mHeadOffset{ 0,0,0 };
bool mRecenter{ true };
float mYaw{ 0.f };
float mVrAngles[3]{ 0.f,0.f,0.f };
};
}
#endif