1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 07:45:33 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrinputmanager.hpp

69 lines
2.1 KiB
C++
Raw Normal View History

#ifndef OPENXR_INPUT_MANAGER_HPP
#define OPENXR_INPUT_MANAGER_HPP
#include "vrviewer.hpp"
2020-03-15 14:31:38 +00:00
#include "realisticcombat.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();
void processAction(const class Action* action, float dt);
2020-02-15 19:01:11 +00:00
Pose getHandPose(int64_t time, TrackedSpace space, Side side);
2020-03-08 13:14:24 +00:00
void updateActivationIndication(void);
void pointActivation(bool onPress);
void injectMousePress(int sdlButton, bool onPress);
void injectChannelValue(MWInput::Actions action, float value);
void applyHapticsLeftHand(float intensity) override;
void applyHapticsRightHand(float intensity) override;
2020-02-15 19:01:11 +00:00
std::unique_ptr<OpenXRInput> mXRInput;
2020-03-15 14:31:38 +00:00
std::unique_ptr<RealisticCombat::StateMachine> mRealisticCombat;
Pose mHeadPose{};
2020-02-23 10:02:38 +00:00
osg::Vec3 mHeadOffset{ 0,0,0 };
2020-05-31 10:15:31 +00:00
bool mShouldRecenter{ true };
2020-03-08 13:14:24 +00:00
bool mActivationIndication{ false };
2020-02-23 10:02:38 +00:00
float mYaw{ 0.f };
float mVrAngles[3]{ 0.f,0.f,0.f };
};
}
#endif