Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_XrAction.h
| Show All 28 Lines | |||||
| #include "GHOST_Util.h" | #include "GHOST_Util.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| class GHOST_XrActionSpace { | class GHOST_XrActionSpace { | ||||
| public: | public: | ||||
| GHOST_XrActionSpace() = delete; /* Default constructor for map storage. */ | GHOST_XrActionSpace() = delete; /* Default constructor for map storage. */ | ||||
| GHOST_XrActionSpace(XrInstance instance, | GHOST_XrActionSpace(XrSession session, | ||||
| XrSession session, | |||||
| XrAction action, | XrAction action, | ||||
| const GHOST_XrActionSpaceInfo &info, | const char *action_name, | ||||
| uint32_t subaction_idx); | const char *profile_path, | ||||
| XrPath subaction_path, | |||||
| const char *subaction_path_str, | |||||
| const GHOST_XrPose &pose); | |||||
| ~GHOST_XrActionSpace(); | ~GHOST_XrActionSpace(); | ||||
| XrSpace getSpace() const; | XrSpace getSpace() const; | ||||
| const XrPath &getSubactionPath() const; | |||||
| private: | private: | ||||
| XrSpace m_space = XR_NULL_HANDLE; | XrSpace m_space = XR_NULL_HANDLE; | ||||
| XrPath m_subaction_path = XR_NULL_PATH; | |||||
| }; | }; | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| typedef struct GHOST_XrSubactionData { | |||||
| XrPath subaction_path = XR_NULL_PATH; | |||||
| float float_threshold; | |||||
| int16_t axis_flag; | |||||
| std::unique_ptr<GHOST_XrActionSpace> space = nullptr; | |||||
| } GHOST_XrSubactionData; | |||||
| /* -------------------------------------------------------------------- */ | |||||
| class GHOST_XrActionProfile { | class GHOST_XrActionProfile { | ||||
| public: | public: | ||||
| GHOST_XrActionProfile() = delete; /* Default constructor for map storage. */ | GHOST_XrActionProfile() = delete; /* Default constructor for map storage. */ | ||||
| GHOST_XrActionProfile(XrInstance instance, | GHOST_XrActionProfile(XrInstance instance, | ||||
| XrSession session, | |||||
| XrAction action, | XrAction action, | ||||
| const char *profile_path, | GHOST_XrActionType type, | ||||
| const GHOST_XrActionBindingInfo &info); | const GHOST_XrActionProfileInfo &info); | ||||
| ~GHOST_XrActionProfile() = default; | ~GHOST_XrActionProfile() = default; | ||||
| XrPath getProfile() const; | |||||
| const GHOST_XrSubactionData *getSubaction(XrPath subaction_path) const; | |||||
| void getBindings(XrAction action, | void getBindings(XrAction action, | ||||
| std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; | std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; | ||||
| private: | private: | ||||
| XrPath m_profile = XR_NULL_PATH; | XrPath m_profile = XR_NULL_PATH; | ||||
| /* Bindings identified by interaction (user (subaction) + component) path. */ | |||||
| /** Subaction data identified by user (subaction) path. */ | |||||
| std::map<std::string, GHOST_XrSubactionData> m_subaction_data; | |||||
| /** Bindings identified by interaction (user (subaction) + component) path. */ | |||||
| std::map<std::string, XrPath> m_bindings; | std::map<std::string, XrPath> m_bindings; | ||||
| }; | }; | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| class GHOST_XrAction { | class GHOST_XrAction { | ||||
| public: | public: | ||||
| GHOST_XrAction() = delete; /* Default constructor for map storage. */ | GHOST_XrAction() = delete; /* Default constructor for map storage. */ | ||||
| GHOST_XrAction(XrInstance instance, XrActionSet action_set, const GHOST_XrActionInfo &info); | GHOST_XrAction(XrInstance instance, XrActionSet action_set, const GHOST_XrActionInfo &info); | ||||
| ~GHOST_XrAction(); | ~GHOST_XrAction(); | ||||
| bool createSpace(XrInstance instance, XrSession session, const GHOST_XrActionSpaceInfo &info); | |||||
| void destroySpace(const char *subaction_path); | |||||
| bool createBinding(XrInstance instance, | bool createBinding(XrInstance instance, | ||||
| const char *profile_path, | XrSession session, | ||||
| const GHOST_XrActionBindingInfo &info); | const GHOST_XrActionProfileInfo &info); | ||||
| void destroyBinding(const char *profile_path); | void destroyBinding(const char *profile_path); | ||||
| void updateState(XrSession session, | void updateState(XrSession session, | ||||
| const char *action_name, | const char *action_name, | ||||
| XrSpace reference_space, | XrSpace reference_space, | ||||
| const XrTime &predicted_display_time); | const XrTime &predicted_display_time); | ||||
| void applyHapticFeedback(XrSession session, | void applyHapticFeedback(XrSession session, | ||||
| const char *action_name, | const char *action_name, | ||||
| const int64_t &duration, | const int64_t &duration, | ||||
| const float &frequency, | const float &frequency, | ||||
| const float &litude); | const float &litude); | ||||
| void stopHapticFeedback(XrSession session, const char *action_name); | void stopHapticFeedback(XrSession session, const char *action_name); | ||||
| void *getCustomdata(); | void *getCustomdata(); | ||||
| void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; | void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; | ||||
| private: | private: | ||||
| XrAction m_action = XR_NULL_HANDLE; | XrAction m_action = XR_NULL_HANDLE; | ||||
| GHOST_XrActionType m_type; | GHOST_XrActionType m_type; | ||||
| std::vector<XrPath> m_subaction_paths; | std::vector<XrPath> m_subaction_paths; | ||||
| /** States for each subaction path. */ | /** States for each subaction path. */ | ||||
| void *m_states; | void *m_states; | ||||
| /** Input thresholds/regions for each subaction path. */ | |||||
| float *m_float_thresholds; | |||||
| int16_t *m_axis_flags; | |||||
| std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrAction */ | std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrAction */ | ||||
| /* Spaces identified by user (subaction) path. */ | /** Profiles identified by interaction profile path. */ | ||||
| std::map<std::string, GHOST_XrActionSpace> m_spaces; | |||||
| /* Profiles identified by interaction profile path. */ | |||||
| std::map<std::string, GHOST_XrActionProfile> m_profiles; | std::map<std::string, GHOST_XrActionProfile> m_profiles; | ||||
| }; | }; | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| class GHOST_XrActionSet { | class GHOST_XrActionSet { | ||||
| public: | public: | ||||
| GHOST_XrActionSet() = delete; /* Default constructor for map storage. */ | GHOST_XrActionSet() = delete; /* Default constructor for map storage. */ | ||||
| Show All 24 Lines | |||||