Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kim <pk15950@gmail.com>2021-05-15 21:33:10 +0300
committerPeter Kim <pk15950@gmail.com>2021-05-15 21:36:31 +0300
commitcb12fb78cad4be5fa18edf0de1f8891cd97a9bed (patch)
tree632e1e9a101ff25fd220b7be51825a0affeddea1 /intern/ghost/GHOST_Types.h
parent3e6609a0dcb064489d91f685583392d8a73219b9 (diff)
XR Controller Support Step 1: Internal Abstractions for OpenXR Actions
Adds internal API for creating and managing OpenXR actions at the GHOST and WM layers. Does not bring about any changes for users since XR action functionality is not yet exposed in the Python API (will be added in a subsequent patch). OpenXR actions are a means to communicate with XR input devices and can be used to retrieve button/pose states or apply haptic feedback. Actions are bound to device inputs via a semantic path binding (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles), which serves as an XR version of keymaps. Main features: - Abstraction of OpenXR action management functions to GHOST-XR, WM-XR APIs. - New "xr_session_start_pre" callback for creating actions at appropriate point in the XR session. - Creation of name-identifiable action sets/actions. - Binding of actions to controller inputs. - Acquisition of controller button states. - Acquisition of controller poses. - Application of controller haptic feedback. - Carefully designed error handling and useful error reporting (e.g. action set/action name included in error message). Reviewed By: Julian Eisel Differential Revision: http://developer.blender.org/D10942
Diffstat (limited to 'intern/ghost/GHOST_Types.h')
-rw-r--r--intern/ghost/GHOST_Types.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 7d819913efc..3a8d0fbfecf 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -634,7 +634,9 @@ typedef enum GHOST_TXrGraphicsBinding {
typedef void (*GHOST_XrErrorHandlerFn)(const struct GHOST_XrError *);
+typedef void (*GHOST_XrSessionCreateFn)(void);
typedef void (*GHOST_XrSessionExitFn)(void *customdata);
+typedef void (*GHOST_XrCustomdataFreeFn)(void *customdata);
typedef void *(*GHOST_XrGraphicsContextBindFn)(void);
typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_ContextHandle graphics_context);
@@ -665,6 +667,7 @@ typedef struct {
typedef struct {
GHOST_XrPose base_pose;
+ GHOST_XrSessionCreateFn create_fn;
GHOST_XrSessionExitFn exit_fn;
void *exit_customdata;
} GHOST_XrSessionBeginInfo;
@@ -691,4 +694,54 @@ typedef struct GHOST_XrError {
void *customdata;
} GHOST_XrError;
-#endif
+typedef struct GHOST_XrActionSetInfo {
+ const char *name;
+
+ GHOST_XrCustomdataFreeFn customdata_free_fn;
+ void *customdata; /* wmXrActionSet */
+} GHOST_XrActionSetInfo;
+
+/** XR action type. Enum values match those in OpenXR's
+ * XrActionType enum for consistency. */
+typedef enum GHOST_XrActionType {
+ GHOST_kXrActionTypeBooleanInput = 1,
+ GHOST_kXrActionTypeFloatInput = 2,
+ GHOST_kXrActionTypeVector2fInput = 3,
+ GHOST_kXrActionTypePoseInput = 4,
+ GHOST_kXrActionTypeVibrationOutput = 100,
+} GHOST_XrActionType;
+
+typedef struct GHOST_XrActionInfo {
+ const char *name;
+ GHOST_XrActionType type;
+ GHOST_TUns32 count_subaction_paths;
+ const char **subaction_paths;
+ /** States for each subaction path. */
+ void *states;
+
+ GHOST_XrCustomdataFreeFn customdata_free_fn;
+ void *customdata; /* wmXrAction */
+} GHOST_XrActionInfo;
+
+typedef struct GHOST_XrActionSpaceInfo {
+ const char *action_name;
+ GHOST_TUns32 count_subaction_paths;
+ const char **subaction_paths;
+ /** Poses for each subaction path. */
+ const GHOST_XrPose *poses;
+} GHOST_XrActionSpaceInfo;
+
+typedef struct GHOST_XrActionBindingInfo {
+ const char *action_name;
+ GHOST_TUns32 count_interaction_paths;
+ /** Interaction path: User (subaction) path + component path. */
+ const char **interaction_paths;
+} GHOST_XrActionBindingInfo;
+
+typedef struct GHOST_XrActionProfileInfo {
+ const char *profile_path;
+ GHOST_TUns32 count_bindings;
+ const GHOST_XrActionBindingInfo *bindings;
+} GHOST_XrActionProfileInfo;
+
+#endif /* WITH_XR_OPENXR */