2020-01-09 23:10:09 +00:00
|
|
|
#ifndef OPENXR_INPUT_MANAGER_HPP
|
|
|
|
#define OPENXR_INPUT_MANAGER_HPP
|
|
|
|
|
2020-02-15 19:01:11 +00:00
|
|
|
#include "openxrviewer.hpp"
|
2020-01-09 23:10:09 +00:00
|
|
|
#include "../mwinput/inputmanagerimp.hpp"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <array>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
namespace MWVR
|
|
|
|
{
|
2020-02-15 19:01:11 +00:00
|
|
|
struct OpenXRInput;
|
|
|
|
struct OpenXRActionEvent;
|
2020-01-23 23:14:23 +00:00
|
|
|
|
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-01-09 23:10:09 +00:00
|
|
|
{
|
2020-02-15 19:01:11 +00:00
|
|
|
public:
|
|
|
|
OpenXRInputManager(
|
|
|
|
SDL_Window* window,
|
|
|
|
osg::ref_ptr<OpenXRViewer> viewer,
|
|
|
|
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-01-09 23:10:09 +00:00
|
|
|
|
2020-02-15 19:01:11 +00:00
|
|
|
virtual ~OpenXRInputManager();
|
2020-01-09 23:10:09 +00:00
|
|
|
|
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);
|
2020-01-23 23:14:23 +00:00
|
|
|
|
2020-02-16 13:53:35 +00:00
|
|
|
void showActivationIndication(bool show);
|
|
|
|
|
2020-02-15 19:01:11 +00:00
|
|
|
osg::ref_ptr<OpenXRViewer> mXRViewer;
|
|
|
|
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 };
|
2020-01-09 23:10:09 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|