Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/xr/intern/wm_xr_intern.h
| Show All 20 Lines | |||||
| #pragma once | #pragma once | ||||
| #include "CLG_log.h" | #include "CLG_log.h" | ||||
| #include "wm_xr.h" | #include "wm_xr.h" | ||||
| struct wmXrActionSet; | 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 { | typedef struct wmXrSessionState { | ||||
| bool is_started; | bool is_started; | ||||
| /** Last known viewer pose (centroid of eyes, in world space) stored for queries. */ | /** Last known viewer pose (centroid of eyes, in world space) stored for queries. */ | ||||
| GHOST_XrPose viewer_pose; | GHOST_XrPose viewer_pose; | ||||
| /** The last known view matrix, calculated from above's viewer pose. */ | /** The last known view matrix, calculated from above's viewer pose. */ | ||||
| float viewer_viewmat[4][4]; | float viewer_viewmat[4][4]; | ||||
| float focal_len; | float focal_len; | ||||
| Show All 10 Lines | typedef struct wmXrSessionState { | ||||
| GHOST_XrPose prev_local_pose; | GHOST_XrPose prev_local_pose; | ||||
| /** Copy of wmXrDrawData.eye_position_ofs. */ | /** Copy of wmXrDrawData.eye_position_ofs. */ | ||||
| float prev_eye_position_ofs[3]; | float prev_eye_position_ofs[3]; | ||||
| bool force_reset_to_base_pose; | bool force_reset_to_base_pose; | ||||
| bool is_view_data_set; | bool is_view_data_set; | ||||
| /** Last known controller data. */ | /** Last known controller data. */ | ||||
| wmXrControllerData controllers[2]; | ListBase controllers; /* wmXrController */ | ||||
| /** The currently active action set that will be updated on calls to | /** 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 | * wm_xr_session_actions_update(). If NULL, all action sets will be treated as active and | ||||
| * updated. */ | * updated. */ | ||||
| struct wmXrActionSet *active_action_set; | struct wmXrActionSet *active_action_set; | ||||
| } wmXrSessionState; | } wmXrSessionState; | ||||
| typedef struct wmXrRuntimeData { | typedef struct wmXrRuntimeData { | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | typedef struct wmXrAction { | ||||
| char **active_modal_path; | char **active_modal_path; | ||||
| /** Operator to be called on XR events. */ | /** Operator to be called on XR events. */ | ||||
| struct wmOperatorType *ot; | struct wmOperatorType *ot; | ||||
| IDProperty *op_properties; | IDProperty *op_properties; | ||||
| eXrOpFlag op_flag; | eXrOpFlag op_flag; | ||||
| } wmXrAction; | } wmXrAction; | ||||
| typedef struct wmXrController { | |||||
| /** 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 { | typedef struct wmXrActionSet { | ||||
| char *name; | char *name; | ||||
| /** XR pose actions that determine the controller grip/aim transforms. */ | |||||
| /** The XR pose action that determines the controller | wmXrAction *controller_grip_action; | ||||
| * transforms. This is usually identified by the OpenXR path "/grip/pose" or "/aim/pose", | wmXrAction *controller_aim_action; | ||||
| * although it could differ depending on the specification and hardware. */ | |||||
| wmXrAction *controller_pose_action; | |||||
| /** The currently active modal action (if any). */ | /** The currently active modal action (if any). */ | ||||
| wmXrAction *active_modal_action; | wmXrAction *active_modal_action; | ||||
| } wmXrActionSet; | } wmXrActionSet; | ||||
| wmXrRuntimeData *wm_xr_runtime_data_create(void); | wmXrRuntimeData *wm_xr_runtime_data_create(void); | ||||
| void wm_xr_runtime_data_free(wmXrRuntimeData **runtime); | void wm_xr_runtime_data_free(wmXrRuntimeData **runtime); | ||||
| void wm_xr_session_draw_data_update(const wmXrSessionState *state, | void wm_xr_session_draw_data_update(const wmXrSessionState *state, | ||||
| const XrSessionSettings *settings, | const XrSessionSettings *settings, | ||||
| const GHOST_XrDrawViewInfo *draw_view, | const GHOST_XrDrawViewInfo *draw_view, | ||||
| wmXrDrawData *draw_data); | wmXrDrawData *draw_data); | ||||
| void wm_xr_session_state_update(const XrSessionSettings *settings, | void wm_xr_session_state_update(const XrSessionSettings *settings, | ||||
| const wmXrDrawData *draw_data, | const wmXrDrawData *draw_data, | ||||
| const GHOST_XrDrawViewInfo *draw_view, | const GHOST_XrDrawViewInfo *draw_view, | ||||
| wmXrSessionState *state); | wmXrSessionState *state); | ||||
| bool wm_xr_session_surface_offscreen_ensure(wmXrSurfaceData *surface_data, | bool wm_xr_session_surface_offscreen_ensure(wmXrSurfaceData *surface_data, | ||||
| const GHOST_XrDrawViewInfo *draw_view); | const GHOST_XrDrawViewInfo *draw_view); | ||||
| void *wm_xr_session_gpu_binding_context_create(void); | void *wm_xr_session_gpu_binding_context_create(void); | ||||
| void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle context); | void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle context); | ||||
| void wm_xr_session_actions_init(wmXrData *xr); | void wm_xr_session_actions_init(wmXrData *xr); | ||||
| void wm_xr_session_actions_update(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); | wmXrData *xr); | ||||
| void wm_xr_session_controller_data_clear(wmXrSessionState *state); | 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_pose_to_mat(const GHOST_XrPose *pose, float r_mat[4][4]); | ||||
| void wm_xr_controller_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); | void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata); | ||||