Blender  V3.3
GHOST_XrAction.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 /* NOTE: Requires OpenXR headers to be included before this one for OpenXR types
8  * (XrSpace, XrPath, etc.). */
9 
10 #pragma once
11 
12 #include <map>
13 #include <memory>
14 #include <string>
15 
16 #include "GHOST_Util.h"
17 
18 /* -------------------------------------------------------------------- */
19 
21  public:
22  GHOST_XrActionSpace() = delete; /* Default constructor for map storage. */
23  GHOST_XrActionSpace(XrSession session,
24  XrAction action,
25  const char *action_name,
26  const char *profile_path,
27  XrPath subaction_path,
28  const char *subaction_path_str,
29  const GHOST_XrPose &pose);
31 
32  XrSpace getSpace() const;
33 
34  private:
35  XrSpace m_space = XR_NULL_HANDLE;
36 };
37 
38 /* -------------------------------------------------------------------- */
39 
40 typedef struct GHOST_XrSubactionData {
41  XrPath subaction_path = XR_NULL_PATH;
44  std::unique_ptr<GHOST_XrActionSpace> space = nullptr;
46 
47 /* -------------------------------------------------------------------- */
48 
50  public:
51  GHOST_XrActionProfile() = delete; /* Default constructor for map storage. */
53  XrSession session,
54  XrAction action,
55  GHOST_XrActionType type,
56  const GHOST_XrActionProfileInfo &info);
58 
59  XrPath getProfile() const;
60  const GHOST_XrSubactionData *getSubaction(XrPath subaction_path) const;
61  void getBindings(XrAction action,
62  std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
63 
64  private:
65  XrPath m_profile = XR_NULL_PATH;
66 
68  std::map<std::string, GHOST_XrSubactionData> m_subaction_data;
70  std::map<std::string, XrPath> m_bindings;
71 };
72 
73 /* -------------------------------------------------------------------- */
74 
76  public:
77  GHOST_XrAction() = delete; /* Default constructor for map storage. */
78  GHOST_XrAction(XrInstance instance, XrActionSet action_set, const GHOST_XrActionInfo &info);
80 
81  bool createBinding(XrInstance instance,
82  XrSession session,
83  const GHOST_XrActionProfileInfo &info);
84  void destroyBinding(const char *profile_path);
85 
86  void updateState(XrSession session,
87  const char *action_name,
88  XrSpace reference_space,
89  const XrTime &predicted_display_time);
90  void applyHapticFeedback(XrSession session,
91  const char *action_name,
92  const char *subaction_path,
93  const int64_t &duration,
94  const float &frequency,
95  const float &amplitude);
96  void stopHapticFeedback(XrSession session, const char *action_name, const char *subaction_path);
97 
98  void *getCustomdata();
99  void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
100 
101  private:
102  using SubactionIndexMap = std::map<std::string, uint32_t>;
103 
104  XrAction m_action = XR_NULL_HANDLE;
105  GHOST_XrActionType m_type;
106  SubactionIndexMap m_subaction_indices;
107  std::vector<XrPath> m_subaction_paths;
109  void *m_states;
111  float *m_float_thresholds;
112  int16_t *m_axis_flags;
113 
114  std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrAction */
115 
117  std::map<std::string, GHOST_XrActionProfile> m_profiles;
118 };
119 
120 /* -------------------------------------------------------------------- */
121 
123  public:
124  GHOST_XrActionSet() = delete; /* Default constructor for map storage. */
125  GHOST_XrActionSet(XrInstance instance, const GHOST_XrActionSetInfo &info);
127 
128  bool createAction(XrInstance instance, const GHOST_XrActionInfo &info);
129  void destroyAction(const char *action_name);
130  GHOST_XrAction *findAction(const char *action_name);
131 
132  void updateStates(XrSession session,
133  XrSpace reference_space,
134  const XrTime &predicted_display_time);
135 
136  XrActionSet getActionSet() const;
137  void *getCustomdata();
138  uint32_t getActionCount() const;
139  void getActionCustomdataArray(void **r_customdata_array);
140  void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
141 
142  private:
143  XrActionSet m_action_set = XR_NULL_HANDLE;
144 
145  std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrActionSet */
146 
147  std::map<std::string, GHOST_XrAction> m_actions;
148 };
149 
150 /* -------------------------------------------------------------------- */
struct GHOST_XrSubactionData GHOST_XrSubactionData
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
void getBindings(XrAction action, std::map< XrPath, std::vector< XrActionSuggestedBinding >> &r_bindings) const
const GHOST_XrSubactionData * getSubaction(XrPath subaction_path) const
XrPath getProfile() const
~GHOST_XrActionProfile()=default
GHOST_XrActionProfile()=delete
GHOST_XrActionSet()=delete
void updateStates(XrSession session, XrSpace reference_space, const XrTime &predicted_display_time)
GHOST_XrAction * findAction(const char *action_name)
void getBindings(std::map< XrPath, std::vector< XrActionSuggestedBinding >> &r_bindings) const
bool createAction(XrInstance instance, const GHOST_XrActionInfo &info)
XrActionSet getActionSet() const
void getActionCustomdataArray(void **r_customdata_array)
uint32_t getActionCount() const
void destroyAction(const char *action_name)
XrSpace getSpace() const
GHOST_XrActionSpace()=delete
bool createBinding(XrInstance instance, XrSession session, const GHOST_XrActionProfileInfo &info)
void updateState(XrSession session, const char *action_name, XrSpace reference_space, const XrTime &predicted_display_time)
void getBindings(std::map< XrPath, std::vector< XrActionSuggestedBinding >> &r_bindings) const
void stopHapticFeedback(XrSession session, const char *action_name, const char *subaction_path)
void applyHapticFeedback(XrSession session, const char *action_name, const char *subaction_path, const int64_t &duration, const float &frequency, const float &amplitude)
void destroyBinding(const char *profile_path)
void * getCustomdata()
GHOST_XrAction()=delete
SocketIndexByIdentifierMap * map
signed short int16_t
Definition: stdint.h:76
unsigned int uint32_t
Definition: stdint.h:80
__int64 int64_t
Definition: stdint.h:89
std::unique_ptr< GHOST_XrActionSpace > space