|
Blender V5.3
|
Abstraction for XR (VR, AR, MR, ..) access via OpenXR. More...
Go to the source code of this file.
Functions | |
| void | GHOST_XrErrorHandler (GHOST_XrErrorHandlerFn handler_fn, void *customdata) |
| GHOST_IXrContext * | GHOST_XrContextCreate (const GHOST_XrContextCreateInfo *create_info) |
| Initialize the Ghost XR-context. | |
| void | GHOST_XrContextDestroy (GHOST_IXrContext *xr_context) |
| void | GHOST_XrGraphicsContextBindFuncs (GHOST_IXrContext *xr_context, GHOST_XrGraphicsContextBindFn bind_fn, GHOST_XrGraphicsContextUnbindFn unbind_fn) |
| void | GHOST_XrDrawViewFunc (GHOST_IXrContext *xr_context, GHOST_XrDrawViewFn draw_view_fn) |
| void | GHOST_XrPassthroughEnabledFunc (GHOST_IXrContext *xr_context, GHOST_XrPassthroughEnabledFn passthrough_enabled_fn) |
| void | GHOST_XrDisablePassthroughFunc (GHOST_IXrContext *xr_context, GHOST_XrDisablePassthroughFn disable_passthrough_fn) |
| void | GHOST_XrSessionStart (GHOST_IXrContext *xr_context, const GHOST_XrSessionBeginInfo *begin_info) |
| void | GHOST_XrSessionEnd (GHOST_IXrContext *xr_context) |
| void | GHOST_XrSessionDrawViews (GHOST_IXrContext *xr_context, void *customdata) |
| int | GHOST_XrSessionIsRunning (const GHOST_IXrContext *xr_context) |
| int | GHOST_XrSessionNeedsUpsideDownDrawing (const GHOST_IXrContext *xr_context) |
| GHOST_TSuccess | GHOST_XrEventsHandle (GHOST_IXrContext *xr_context) |
| int | GHOST_XrCreateActionSet (GHOST_IXrContext *xr_context, const GHOST_XrActionSetInfo *info) |
| void | GHOST_XrDestroyActionSet (GHOST_IXrContext *xr_context, const char *action_set_name) |
| int | GHOST_XrCreateActions (GHOST_IXrContext *xr_context, const char *action_set_name, uint32_t count, const GHOST_XrActionInfo *infos) |
| void | GHOST_XrDestroyActions (GHOST_IXrContext *xr_context, const char *action_set_name, uint32_t count, const char *const *action_names) |
| int | GHOST_XrCreateActionBindings (GHOST_IXrContext *xr_context, const char *action_set_name, uint32_t count, const GHOST_XrActionProfileInfo *infos) |
| void | GHOST_XrDestroyActionBindings (GHOST_IXrContext *xr_context, const char *action_set_name, uint32_t count, const char *const *action_names, const char *const *profile_paths) |
| int | GHOST_XrAttachActionSets (GHOST_IXrContext *xr_context) |
| int | GHOST_XrSyncActions (GHOST_IXrContext *xr_context, const char *action_set_name) |
| int | GHOST_XrApplyHapticAction (GHOST_IXrContext *xr_context_handle, const char *action_set_name, const char *action_name, const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude) |
| void | GHOST_XrStopHapticAction (GHOST_IXrContext *xr_context_handle, const char *action_set_name, const char *action_name, const char *subaction_path) |
| void * | GHOST_XrGetActionSetCustomdata (GHOST_IXrContext *xr_context, const char *action_set_name) |
| void * | GHOST_XrGetActionCustomdata (GHOST_IXrContext *xr_context, const char *action_set_name, const char *action_name) |
| unsigned int | GHOST_XrGetActionCount (GHOST_IXrContext *xr_context, const char *action_set_name) |
| void | GHOST_XrGetActionCustomdataArray (GHOST_IXrContext *xr_context, const char *action_set_name, void **r_customdata_array) |
| int | GHOST_XrLoadControllerModel (GHOST_IXrContext *xr_context, const char *subaction_path) |
| void | GHOST_XrUnloadControllerModel (GHOST_IXrContext *xr_context, const char *subaction_path) |
| int | GHOST_XrUpdateControllerModelComponents (GHOST_IXrContext *xr_context, const char *subaction_path) |
| int | GHOST_XrGetControllerModelData (GHOST_IXrContext *xr_context, const char *subaction_path, GHOST_XrControllerModelData *r_data) |
Abstraction for XR (VR, AR, MR, ..) access via OpenXR.
Definition in file GHOST_Xr-api.hh.
| int GHOST_XrApplyHapticAction | ( | GHOST_IXrContext * | xr_context_handle, |
| const char * | action_set_name, | ||
| const char * | action_name, | ||
| const char * | subaction_path, | ||
| const int64_t * | duration, | ||
| const float * | frequency, | ||
| const float * | amplitude ) |
Apply an OpenXR haptic output action.
Definition at line 183 of file GHOST_Xr.cc.
References GHOST_XrSession::applyHapticAction(), frequency, GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrApplyHapticAction().
Referenced by GHOST_XrApplyHapticAction(), and blender::WM_xr_haptic_action_apply().
| int GHOST_XrAttachActionSets | ( | GHOST_IXrContext * | xr_context | ) |
Attach all created action sets to the current OpenXR session.
Definition at line 169 of file GHOST_Xr.cc.
References GHOST_XrSession::attachActionSets(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrAttachActionSets().
Referenced by GHOST_XrAttachActionSets(), and blender::wm_xr_session_actions_init().
| GHOST_IXrContext * GHOST_XrContextCreate | ( | const GHOST_XrContextCreateInfo * | create_info | ) |
Initialize the Ghost XR-context.
Includes setting up the OpenXR runtime link, querying available extensions and API layers, enabling extensions and API layers.
| create_info | Options for creating the XR-context, e.g. debug-flags and ordered array of graphics bindings to try enabling. |
Definition at line 40 of file GHOST_Xr.cc.
References GHOST_XrContextCreate().
Referenced by GHOST_XrContextCreate(), and blender::wm_xr_init().
| void GHOST_XrContextDestroy | ( | GHOST_IXrContext * | xr_context | ) |
Free a XR-context involving OpenXR runtime link destruction and freeing of all internal data.
Definition at line 58 of file GHOST_Xr.cc.
References GHOST_XrContextDestroy().
Referenced by GHOST_XrContextDestroy(), GHOST_XrEventsHandle(), and blender::wm_xr_runtime_data_free().
| int GHOST_XrCreateActionBindings | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| uint32_t | count, | ||
| const GHOST_XrActionProfileInfo * | infos ) |
Create input/output path bindings for OpenXR actions.
Definition at line 146 of file GHOST_Xr.cc.
References GHOST_XrSession::createActionBindings(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrCreateActionBindings().
Referenced by GHOST_XrCreateActionBindings(), and blender::WM_xr_action_binding_create().
| int GHOST_XrCreateActions | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| uint32_t | count, | ||
| const GHOST_XrActionInfo * | infos ) |
Create OpenXR input/output actions.
Definition at line 127 of file GHOST_Xr.cc.
References GHOST_XrSession::createActions(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrCreateActions().
Referenced by GHOST_XrCreateActions(), and blender::WM_xr_action_create().
| int GHOST_XrCreateActionSet | ( | GHOST_IXrContext * | xr_context, |
| const GHOST_XrActionSetInfo * | info ) |
Create an OpenXR action set for input/output.
Definition at line 114 of file GHOST_Xr.cc.
References GHOST_XrSession::createActionSet(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrCreateActionSet().
Referenced by GHOST_XrCreateActionSet(), and blender::WM_xr_action_set_create().
| void GHOST_XrDestroyActionBindings | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| uint32_t | count, | ||
| const char *const * | action_names, | ||
| const char *const * | profile_paths ) |
Destroy previously created bindings for OpenXR actions.
Definition at line 157 of file GHOST_Xr.cc.
References GHOST_XrSession::destroyActionBindings(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, and GHOST_XrDestroyActionBindings().
Referenced by GHOST_XrDestroyActionBindings(), and blender::WM_xr_action_binding_destroy().
| void GHOST_XrDestroyActions | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| uint32_t | count, | ||
| const char *const * | action_names ) |
Destroy previously created OpenXR actions.
Definition at line 137 of file GHOST_Xr.cc.
References GHOST_XrSession::destroyActions(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, and GHOST_XrDestroyActions().
Referenced by GHOST_XrDestroyActions(), and blender::WM_xr_action_destroy().
| void GHOST_XrDestroyActionSet | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name ) |
Destroy a previously created OpenXR action set.
Definition at line 121 of file GHOST_Xr.cc.
References GHOST_XrSession::destroyActionSet(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, and GHOST_XrDestroyActionSet().
Referenced by GHOST_XrDestroyActionSet(), and blender::WM_xr_action_set_destroy().
| void GHOST_XrDisablePassthroughFunc | ( | GHOST_IXrContext * | xr_context, |
| GHOST_XrDisablePassthroughFn | disable_passthrough_fn ) |
Set the callback to force disable passthrough in case it is not supported. Called in GHOST_XrSession::draw().
| disable_passthrough_fn | The callback to disable passthrough. |
Definition at line 102 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL, GHOST_XrDisablePassthroughFunc(), and GHOST_IXrContext::setDisablePassthroughFunc().
Referenced by GHOST_XrDisablePassthroughFunc(), and blender::wm_xr_init().
| void GHOST_XrDrawViewFunc | ( | GHOST_IXrContext * | xr_context, |
| GHOST_XrDrawViewFn | draw_view_fn ) |
Set the drawing callback for views. A view would typically be either the left or the right eye, although other configurations are possible. When GHOST_XrSessionDrawViews() is called to draw an XR frame, draw_view_fn is executed for each view.
| draw_view_fn | The callback to draw a single view for an XR frame. |
Definition at line 91 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL, GHOST_XrDrawViewFunc(), and GHOST_IXrContext::setDrawViewFunc().
Referenced by GHOST_XrDrawViewFunc(), and blender::wm_xr_init().
| void GHOST_XrErrorHandler | ( | GHOST_XrErrorHandlerFn | handler_fn, |
| void * | customdata ) |
Set a custom callback to be executed whenever an error occurs. Should be set before calling GHOST_XrContextCreate() to get error handling during context creation too.
| customdata | Handle to some data that will get passed to handler_fn should an error be thrown. |
Definition at line 35 of file GHOST_Xr.cc.
References GHOST_XrErrorHandler(), and GHOST_XrContext::setErrorHandler().
Referenced by GHOST_XrErrorHandler(), and blender::wm_xr_init().
| GHOST_TSuccess GHOST_XrEventsHandle | ( | GHOST_IXrContext * | xr_context | ) |
Invoke handling of all OpenXR events for xr_context. Should be called on every main-loop iteration and will early-exit if xr_context is nullptr (so caller doesn't have to check).
Definition at line 22 of file GHOST_XrEvent.cc.
References CLOG_INFO, GHOST_XrContext::getInstance(), GHOST_kFailure, GHOST_kSuccess, GHOST_XrContextDestroy(), GHOST_XrEventPollNext(), GHOST_XrEventsHandle(), GHOST_XrContext::handleSessionStateChange(), LOG_GHOST_XR, and CLG_LogRef::type.
Referenced by GHOST_XrEventsHandle(), and blender::wm_xr_events_handle().
| unsigned int GHOST_XrGetActionCount | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name ) |
Get the number of actions in an action set.
Definition at line 226 of file GHOST_Xr.cc.
References GHOST_XrSession::getActionCount(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrGetActionCount().
Referenced by GHOST_XrGetActionCount(), and blender::wm_xr_session_events_dispatch().
| void * GHOST_XrGetActionCustomdata | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| const char * | action_name ) |
Get action custom data (owned by Blender, not GHOST).
Definition at line 216 of file GHOST_Xr.cc.
References GHOST_XrSession::getActionCustomdata(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrGetActionCustomdata().
Referenced by blender::action_find(), GHOST_XrGetActionCustomdata(), and blender::wm_xr_session_events_dispatch().
| void GHOST_XrGetActionCustomdataArray | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name, | ||
| void ** | r_customdata_array ) |
Get custom data for all actions in an action set.
Definition at line 233 of file GHOST_Xr.cc.
References GHOST_XrSession::getActionCustomdataArray(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, and GHOST_XrGetActionCustomdataArray().
Referenced by GHOST_XrGetActionCustomdataArray(), and blender::wm_xr_session_events_dispatch().
| void * GHOST_XrGetActionSetCustomdata | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name ) |
Get action set custom data (owned by Blender, not GHOST).
Definition at line 209 of file GHOST_Xr.cc.
References GHOST_XrSession::getActionSetCustomdata(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrGetActionSetCustomdata().
Referenced by blender::action_set_find(), and GHOST_XrGetActionSetCustomdata().
| int GHOST_XrGetControllerModelData | ( | GHOST_IXrContext * | xr_context, |
| const char * | subaction_path, | ||
| GHOST_XrControllerModelData * | r_data ) |
Get vertex data for the OpenXR controller model.
Definition at line 263 of file GHOST_Xr.cc.
References GHOST_XrSession::getControllerModelData(), GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, and GHOST_XrGetControllerModelData().
Referenced by GHOST_XrGetControllerModelData(), blender::wm_xr_controller_model_batch_create(), and blender::wm_xr_controller_model_draw().
| void GHOST_XrGraphicsContextBindFuncs | ( | GHOST_IXrContext * | xr_context, |
| GHOST_XrGraphicsContextBindFn | bind_fn, | ||
| GHOST_XrGraphicsContextUnbindFn | unbind_fn ) |
Set callbacks for binding and unbinding a graphics context for a session. The binding callback may create a new graphics context thereby. In fact that's the sole reason for this callback approach to binding. Just make sure to have an unbind function set that properly destructs.
| bind_fn | Function to retrieve (possibly create) a graphics context. |
| unbind_fn | Function to release (possibly free) a graphics context. |
Definition at line 84 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL, GHOST_XrGraphicsContextBindFuncs(), and GHOST_IXrContext::setGraphicsContextBindFuncs().
Referenced by GHOST_XrGraphicsContextBindFuncs(), and blender::wm_xr_init().
| int GHOST_XrLoadControllerModel | ( | GHOST_IXrContext * | xr_context, |
| const char * | subaction_path ) |
Load the OpenXR controller model.
Definition at line 242 of file GHOST_Xr.cc.
References GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, GHOST_XrLoadControllerModel(), and GHOST_XrSession::loadControllerModel().
Referenced by GHOST_XrLoadControllerModel(), and blender::wm_xr_session_controller_data_update().
| void GHOST_XrPassthroughEnabledFunc | ( | GHOST_IXrContext * | xr_context, |
| GHOST_XrPassthroughEnabledFn | passthrough_enabled_fn ) |
Set the callback to check if passthrough is enabled. If enabled, the passthrough composition layer is added in GHOST_XrSession::draw().
| passthrough_enabled_fn | The callback to check if passthrough is enabled. |
Definition at line 96 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL, GHOST_XrPassthroughEnabledFunc(), and GHOST_IXrContext::setPassthroughEnabledFunc().
Referenced by GHOST_XrPassthroughEnabledFunc(), and blender::wm_xr_init().
| void GHOST_XrSessionDrawViews | ( | GHOST_IXrContext * | xr_context, |
| void * | customdata ) |
Draw a single frame by calling the view drawing callback defined by GHOST_XrDrawViewFunc() for each view and submit it to the OpenXR runtime.
| customdata | Handle to some data that will get passed to the view drawing callback. |
Definition at line 73 of file GHOST_Xr.cc.
References GHOST_IXrContext::drawSessionViews(), GHOST_XR_CAPI_CALL, and GHOST_XrSessionDrawViews().
Referenced by GHOST_XrSessionDrawViews(), and blender::wm_xr_session_surface_draw().
| void GHOST_XrSessionEnd | ( | GHOST_IXrContext * | xr_context | ) |
Destruct internal session data for xr_context and ask the OpenXR runtime to stop a session.
Definition at line 68 of file GHOST_Xr.cc.
References GHOST_IXrContext::endSession(), GHOST_XR_CAPI_CALL, and GHOST_XrSessionEnd().
Referenced by GHOST_XrSessionEnd(), and blender::wm_xr_session_toggle().
| int GHOST_XrSessionIsRunning | ( | const GHOST_IXrContext * | xr_context | ) |
Check if a xr_context has a session that, according to the OpenXR definition would be considered to be 'running' (https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#session_running).
Definition at line 78 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL_RET, GHOST_XrSessionIsRunning(), and GHOST_IXrContext::isSessionRunning().
Referenced by GHOST_XrSessionIsRunning(), and blender::WM_xr_session_is_ready().
| int GHOST_XrSessionNeedsUpsideDownDrawing | ( | const GHOST_IXrContext * | xr_context | ) |
Check if xr_context has a session that requires an upside-down frame-buffer (compared to GPU). If true, the render result should be flipped vertically for correct output.
Definition at line 108 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL_RET, GHOST_XrSessionNeedsUpsideDownDrawing(), and GHOST_IXrContext::needsUpsideDownDrawing().
Referenced by GHOST_XrSessionNeedsUpsideDownDrawing(), and blender::wm_xr_draw_viewport_buffers_to_active_framebuffer().
| void GHOST_XrSessionStart | ( | GHOST_IXrContext * | xr_context, |
| const GHOST_XrSessionBeginInfo * | begin_info ) |
Create internal session data for xr_context and ask the OpenXR runtime to invoke a session.
| begin_info | Options for the session creation. |
Definition at line 63 of file GHOST_Xr.cc.
References GHOST_XR_CAPI_CALL, GHOST_XrSessionStart(), and GHOST_IXrContext::startSession().
Referenced by GHOST_XrSessionStart(), and blender::wm_xr_session_toggle().
| void GHOST_XrStopHapticAction | ( | GHOST_IXrContext * | xr_context_handle, |
| const char * | action_set_name, | ||
| const char * | action_name, | ||
| const char * | subaction_path ) |
Stop a previously applied OpenXR haptic output action.
Definition at line 199 of file GHOST_Xr.cc.
References GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, GHOST_XrStopHapticAction(), and GHOST_XrSession::stopHapticAction().
Referenced by GHOST_XrStopHapticAction(), and blender::WM_xr_haptic_action_stop().
| int GHOST_XrSyncActions | ( | GHOST_IXrContext * | xr_context, |
| const char * | action_set_name ) |
Update button/tracking states for OpenXR actions.
| action_set_name | The name of the action set to sync. If nullptr, all action sets attached to the session will be synced. |
Definition at line 176 of file GHOST_Xr.cc.
References GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, GHOST_XrSyncActions(), and GHOST_XrSession::syncActions().
Referenced by GHOST_XrSyncActions(), and blender::wm_xr_session_actions_update().
| void GHOST_XrUnloadControllerModel | ( | GHOST_IXrContext * | xr_context, |
| const char * | subaction_path ) |
Unload the OpenXR controller model.
Definition at line 249 of file GHOST_Xr.cc.
References GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL, GHOST_XrUnloadControllerModel(), and GHOST_XrSession::unloadControllerModel().
Referenced by GHOST_XrUnloadControllerModel().
| int GHOST_XrUpdateControllerModelComponents | ( | GHOST_IXrContext * | xr_context, |
| const char * | subaction_path ) |
Update component transforms for the OpenXR controller model.
Definition at line 255 of file GHOST_Xr.cc.
References GHOST_IXrContext::getSession(), GHOST_XR_CAPI_CALL_RET, GHOST_XrUpdateControllerModelComponents(), and GHOST_XrSession::updateControllerModelComponents().
Referenced by GHOST_XrUpdateControllerModelComponents(), and blender::wm_xr_session_controller_data_update().