#ifndef OPENXR_ACTIONSET_HPP #define OPENXR_ACTIONSET_HPP #include "vrinput.hpp" #include #include namespace MWVR { /// \brief Generates and manages an OpenXR ActionSet and associated actions. class OpenXRActionSet { public: using Actions = MWInput::Actions; OpenXRActionSet(const std::string& actionSetName, std::shared_ptr deadzone); //! Update all controls and queue any actions void updateControls(); //! Get next action from queue (repeat until null is returned) const Action* nextAction(); //! Get current pose of limb in space. Pose getLimbPose(int64_t time, TrackedLimb limb); //! Apply haptics of the given intensity to the given limb void applyHaptics(TrackedLimb limb, float intensity); XrActionSet xrActionSet() { return mActionSet; }; void suggestBindings(std::vector& xrSuggestedBindings, const SuggestedBindings& mwSuggestedBindings); XrSpace xrActionSpace(TrackedLimb limb); void createMWAction(VrControlType controlType, int openMWAction, const std::string& actionName, const std::string& localName); void createPoseAction(TrackedLimb limb, const std::string& actionName, const std::string& localName); void createHapticsAction(TrackedLimb limb, const std::string& actionName, const std::string& localName); protected: template void createMWAction(int openMWAction, const std::string& actionName, const std::string& localName); std::unique_ptr createXRAction(XrActionType actionType, const std::string& actionName, const std::string& localName); XrPath getXrPath(const std::string& path); XrActionSet createActionSet(const std::string& name); XrActionSet mActionSet{ nullptr }; std::string mLocalizedName{}; std::string mInternalName{}; std::map> mActionMap; std::map> mTrackerMap; std::map> mHapticsMap; std::deque mActionQueue{}; std::shared_ptr mDeadzone; }; } #endif