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-08-05 15:11:01 +0300
committerPeter Kim <pk15950@gmail.com>2021-08-05 15:11:01 +0300
commitfb1822ddeb28037544e94862112aa7338a0c278b (patch)
tree267df230cd7bbe4bff3dfee204755b959ddc2d30 /source/blender/windowmanager/xr/intern/wm_xr_intern.h
parentf45860fba9c47466a18d92c1621c153aaef7be05 (diff)
XR: Controller Data Improvements
Provides two key improvements to runtime controller data. 1. Separates controller poses into two components, "grip" and "aim", which are both required to accurately represent the controllers without manual offsets. Following their OpenXR definitions, the grip pose represents the user's hand when holding the controller, and the aim pose represents the controller's aiming source. 2. Runtime controller data is now stored as a dynamic array instead of a fixed array. This makes the API/functionality more adaptable to different systems. Does not bring about any changes for users since only internal runtime functionality is currently affected. Reviewed By: Julian Eisel Differential Revision: http://developer.blender.org/D12073
Diffstat (limited to 'source/blender/windowmanager/xr/intern/wm_xr_intern.h')
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_intern.h47
1 files changed, 24 insertions, 23 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
index 4530aeaa428..b6aff1f71f9 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h
+++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
@@ -26,19 +26,6 @@
struct wmXrActionSet;
-typedef struct wmXrControllerData {
- /** OpenXR path identifier. Length is dependent on OpenXR's XR_MAX_PATH_LENGTH (256).
- This subaction path will later be combined with a component path, and that combined path should
- also have a max of XR_MAX_PATH_LENGTH (e.g. subaction_path = /user/hand/left, component_path =
- /input/trigger/value, interaction_path = /user/hand/left/input/trigger/value).
- */
- char subaction_path[64];
- /** Last known controller pose (in world space) stored for queries. */
- GHOST_XrPose pose;
- /** The last known controller matrix, calculated from above's controller pose. */
- float mat[4][4];
-} wmXrControllerData;
-
typedef struct wmXrSessionState {
bool is_started;
@@ -65,7 +52,7 @@ typedef struct wmXrSessionState {
bool is_view_data_set;
/** Last known controller data. */
- wmXrControllerData controllers[2];
+ ListBase controllers; /* wmXrController */
/** The currently active action set that will be updated on calls to
* wm_xr_session_actions_update(). If NULL, all action sets will be treated as active and
@@ -135,14 +122,27 @@ typedef struct wmXrAction {
eXrOpFlag op_flag;
} wmXrAction;
+typedef struct wmXrController {
+ struct wmXrController *next, *prev;
+ /** OpenXR path identifier. Length is dependent on OpenXR's XR_MAX_PATH_LENGTH (256).
+ This subaction path will later be combined with a component path, and that combined path should
+ also have a max of XR_MAX_PATH_LENGTH (e.g. subaction_path = /user/hand/left, component_path =
+ /input/trigger/value, interaction_path = /user/hand/left/input/trigger/value).
+ */
+ char subaction_path[64];
+ /* Pose (in world space) that represents the user's hand when holding the controller.*/
+ GHOST_XrPose grip_pose;
+ float grip_mat[4][4];
+ /* Pose (in world space) that represents the controller's aiming source. */
+ GHOST_XrPose aim_pose;
+ float aim_mat[4][4];
+} wmXrController;
+
typedef struct wmXrActionSet {
char *name;
-
- /** The XR pose action that determines the controller
- * transforms. This is usually identified by the OpenXR path "/grip/pose" or "/aim/pose",
- * although it could differ depending on the specification and hardware. */
- wmXrAction *controller_pose_action;
-
+ /** XR pose actions that determine the controller grip/aim transforms. */
+ wmXrAction *controller_grip_action;
+ wmXrAction *controller_aim_action;
/** The currently active modal action (if any). */
wmXrAction *active_modal_action;
} wmXrActionSet;
@@ -165,10 +165,11 @@ void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle context);
void wm_xr_session_actions_init(wmXrData *xr);
void wm_xr_session_actions_update(wmXrData *xr);
-void wm_xr_session_controller_data_populate(const wmXrAction *controller_pose_action,
+void wm_xr_session_controller_data_populate(const wmXrAction *grip_action,
+ const wmXrAction *aim_action,
wmXrData *xr);
void wm_xr_session_controller_data_clear(wmXrSessionState *state);
-void wm_xr_pose_to_viewmat(const GHOST_XrPose *pose, float r_viewmat[4][4]);
-void wm_xr_controller_pose_to_mat(const GHOST_XrPose *pose, float r_mat[4][4]);
+void wm_xr_pose_to_mat(const GHOST_XrPose *pose, float r_mat[4][4]);
+void wm_xr_pose_to_imat(const GHOST_XrPose *pose, float r_imat[4][4]);
void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata);