|
Blender V4.5
|
#include "BKE_callbacks.hh"#include "BKE_context.hh"#include "BKE_global.hh"#include "BKE_idprop.hh"#include "BKE_main.hh"#include "BKE_scene.hh"#include "BKE_screen.hh"#include "BLI_listbase.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_string.h"#include "BLI_time.h"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"#include "DNA_camera_types.h"#include "DNA_space_types.h"#include "DRW_engine.hh"#include "ED_screen.hh"#include "ED_space_api.hh"#include "GHOST_C-api.h"#include "GPU_batch.hh"#include "GPU_viewport.hh"#include "MEM_guardedalloc.h"#include "WM_api.hh"#include "WM_types.hh"#include "wm_event_system.hh"#include "wm_surface.hh"#include "wm_window.hh"#include "wm_xr_intern.hh"Go to the source code of this file.
Enumerations | |
| enum | wmXrSessionStateEvent { SESSION_STATE_EVENT_NONE = 0 , SESSION_STATE_EVENT_START , SESSION_STATE_EVENT_RESET_TO_BASE_POSE , SESSION_STATE_EVENT_POSITION_TRACKING_TOGGLE } |
Functions | |
| static void | wm_xr_session_create_cb () |
| static void | wm_xr_session_controller_data_free (wmXrSessionState *state) |
| void | wm_xr_session_data_free (wmXrSessionState *state) |
| static void | wm_xr_session_exit_cb (void *customdata) |
| static void | wm_xr_session_begin_info_create (wmXrData *xr_data, GHOST_XrSessionBeginInfo *r_begin_info) |
| void | wm_xr_session_toggle (wmWindowManager *wm, wmWindow *session_root_win, wmXrSessionExitFn session_exit_fn) |
| bool | WM_xr_session_exists (const wmXrData *xr) |
| void | WM_xr_session_base_pose_reset (wmXrData *xr) |
| bool | WM_xr_session_is_ready (const wmXrData *xr) |
| static void | wm_xr_session_base_pose_calc (const Scene *scene, const XrSessionSettings *settings, GHOST_XrPose *r_base_pose, float *r_base_scale) |
| static void | wm_xr_session_draw_data_populate (wmXrData *xr_data, Scene *scene, Depsgraph *depsgraph, wmXrDrawData *r_draw_data) |
| wmWindow * | wm_xr_session_root_window_or_fallback_get (const wmWindowManager *wm, const wmXrRuntimeData *runtime_data) |
| static void | wm_xr_session_scene_and_depsgraph_get (const wmWindowManager *wm, Scene **r_scene, Depsgraph **r_depsgraph) |
| static bool | wm_xr_session_draw_data_needs_reset_to_base_pose (const wmXrSessionState *state, const XrSessionSettings *settings) |
| static wmXrSessionStateEvent | wm_xr_session_state_to_event (const wmXrSessionState *state, const XrSessionSettings *settings) |
| void | wm_xr_session_draw_data_update (wmXrSessionState *state, const XrSessionSettings *settings, const GHOST_XrDrawViewInfo *draw_view, wmXrDrawData *draw_data) |
| void | wm_xr_session_state_update (const XrSessionSettings *settings, const wmXrDrawData *draw_data, const GHOST_XrDrawViewInfo *draw_view, wmXrSessionState *state) |
| wmXrSessionState * | WM_xr_session_state_handle_get (const wmXrData *xr) |
| ScrArea * | WM_xr_session_area_get (const wmXrData *xr) |
| bool | WM_xr_session_state_viewer_pose_location_get (const wmXrData *xr, float r_location[3]) |
| bool | WM_xr_session_state_viewer_pose_rotation_get (const wmXrData *xr, float r_rotation[4]) |
| bool | WM_xr_session_state_viewer_pose_matrix_info_get (const wmXrData *xr, float r_viewmat[4][4], float *r_focal_len) |
| bool | WM_xr_session_state_controller_grip_location_get (const wmXrData *xr, uint subaction_idx, float r_location[3]) |
| bool | WM_xr_session_state_controller_grip_rotation_get (const wmXrData *xr, uint subaction_idx, float r_rotation[4]) |
| bool | WM_xr_session_state_controller_aim_location_get (const wmXrData *xr, uint subaction_idx, float r_location[3]) |
| bool | WM_xr_session_state_controller_aim_rotation_get (const wmXrData *xr, uint subaction_idx, float r_rotation[4]) |
| bool | WM_xr_session_state_nav_location_get (const wmXrData *xr, float r_location[3]) |
| void | WM_xr_session_state_nav_location_set (wmXrData *xr, const float location[3]) |
| bool | WM_xr_session_state_nav_rotation_get (const wmXrData *xr, float r_rotation[4]) |
| void | WM_xr_session_state_nav_rotation_set (wmXrData *xr, const float rotation[4]) |
| bool | WM_xr_session_state_nav_scale_get (const wmXrData *xr, float *r_scale) |
| void | WM_xr_session_state_nav_scale_set (wmXrData *xr, float scale) |
| void | WM_xr_session_state_navigation_reset (wmXrSessionState *state) |
XR-Session Actions | |
XR action processing and event dispatching. | |
| void | wm_xr_session_actions_init (wmXrData *xr) |
| static void | wm_xr_session_controller_pose_calc (const GHOST_XrPose *raw_pose, const float view_ofs[3], const float base_mat[4][4], const float nav_mat[4][4], GHOST_XrPose *r_pose, float r_mat[4][4], float r_mat_base[4][4]) |
| static void | wm_xr_session_controller_data_update (const XrSessionSettings *settings, const wmXrAction *grip_action, const wmXrAction *aim_action, GHOST_XrContextHandle xr_context, wmXrSessionState *state) |
| static const GHOST_XrPose * | wm_xr_session_controller_aim_pose_find (const wmXrSessionState *state, const char *subaction_path) |
| BLI_INLINE bool | test_float_state (const float *state, float threshold, eXrAxisFlag flag) |
| BLI_INLINE bool | test_vec2f_state (const float state[2], float threshold, eXrAxisFlag flag) |
| static bool | wm_xr_session_modal_action_test (const ListBase *active_modal_actions, const wmXrAction *action, bool *r_found) |
| static void | wm_xr_session_modal_action_test_add (ListBase *active_modal_actions, const wmXrAction *action) |
| static void | wm_xr_session_modal_action_remove (ListBase *active_modal_actions, const wmXrAction *action) |
| static wmXrHapticAction * | wm_xr_session_haptic_action_find (ListBase *active_haptic_actions, const wmXrAction *action, const char *subaction_path) |
| static void | wm_xr_session_haptic_action_add (ListBase *active_haptic_actions, const wmXrAction *action, const char *subaction_path, int64_t time_now) |
| static void | wm_xr_session_haptic_action_remove (ListBase *active_haptic_actions, const wmXrAction *action) |
| static void | wm_xr_session_haptic_timers_check (ListBase *active_haptic_actions, int64_t time_now) |
| static void | wm_xr_session_action_states_interpret (wmXrData *xr, const char *action_set_name, wmXrAction *action, uint subaction_idx, ListBase *active_modal_actions, ListBase *active_haptic_actions, int64_t time_now, bool modal, bool haptic, short *r_val) |
| static bool | wm_xr_session_action_test_bimanual (const wmXrSessionState *session_state, wmXrAction *action, uint subaction_idx, uint *r_subaction_idx_other, const GHOST_XrPose **r_aim_pose_other) |
| static wmXrActionData * | wm_xr_session_event_create (const char *action_set_name, const wmXrAction *action, const GHOST_XrPose *controller_aim_pose, const GHOST_XrPose *controller_aim_pose_other, uint subaction_idx, uint subaction_idx_other, bool bimanual) |
| static void | wm_xr_session_events_dispatch (wmXrData *xr, GHOST_XrContextHandle xr_context, wmXrActionSet *action_set, wmXrSessionState *session_state, wmWindow *win) |
| void | wm_xr_session_actions_update (wmWindowManager *wm) |
| 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) |
XR-Session Surface | |
A wmSurface is used to manage drawing of the VR viewport. It's created and destroyed with the session. | |
| static void | wm_xr_session_surface_draw (bContext *C) |
| Call Ghost-XR to draw a frame. | |
| static void | wm_xr_session_do_depsgraph (bContext *C) |
| bool | wm_xr_session_surface_offscreen_ensure (wmXrSurfaceData *surface_data, const GHOST_XrDrawViewInfo *draw_view) |
| static void | wm_xr_session_surface_free_data (wmSurface *surface) |
| static wmSurface * | wm_xr_session_surface_create () |
| void * | wm_xr_session_gpu_binding_context_create () |
| void | wm_xr_session_gpu_binding_context_destroy (GHOST_ContextHandle) |
| ARegionType * | WM_xr_surface_controller_region_type_get () |
Variables | |
| static wmSurface * | g_xr_surface = nullptr |
| static CLG_LogRef | LOG = {"wm.xr"} |
| Enumerator | |
|---|---|
| SESSION_STATE_EVENT_NONE | |
| SESSION_STATE_EVENT_START | |
| SESSION_STATE_EVENT_RESET_TO_BASE_POSE | |
| SESSION_STATE_EVENT_POSITION_TRACKING_TOGGLE | |
Definition at line 252 of file wm_xr_session.cc.
| BLI_INLINE bool test_float_state | ( | const float * | state, |
| float | threshold, | ||
| eXrAxisFlag | flag ) |
Definition at line 679 of file wm_xr_session.cc.
References BLI_INLINE, fabsf, flag, state, XR_AXIS0_NEG, and XR_AXIS0_POS.
Referenced by wm_xr_session_action_states_interpret(), and wm_xr_session_action_test_bimanual().
| BLI_INLINE bool test_vec2f_state | ( | const float | state[2], |
| float | threshold, | ||
| eXrAxisFlag | flag ) |
Definition at line 699 of file wm_xr_session.cc.
References BLI_INLINE, flag, len_v2(), state, XR_AXIS0_NEG, XR_AXIS0_POS, XR_AXIS1_NEG, and XR_AXIS1_POS.
Referenced by wm_xr_session_action_states_interpret(), and wm_xr_session_action_test_bimanual().
|
static |
Definition at line 826 of file wm_xr_session.cc.
References wmXrAction::active_modal_path, wmXrAction::axis_flags, BLI_assert_unreachable, copy_v2_v2(), wmXrAction::float_thresholds, wmXrAction::haptic_amplitude, wmXrAction::haptic_duration, wmXrAction::haptic_flag, wmXrAction::haptic_frequency, wmXrAction::haptic_name, KM_PRESS, KM_RELEASE, wmXrAction::op_flag, state, wmXrAction::states, wmXrAction::states_prev, wmXrAction::subaction_paths, test_float_state(), test_vec2f_state(), wmXrAction::type, WM_xr_haptic_action_apply(), WM_xr_haptic_action_stop(), wm_xr_session_haptic_action_add(), wm_xr_session_haptic_action_find(), wm_xr_session_haptic_action_remove(), wm_xr_session_modal_action_remove(), wm_xr_session_modal_action_test_add(), XR_BOOLEAN_INPUT, XR_FLOAT_INPUT, XR_HAPTIC_MATCHUSERPATHS, XR_HAPTIC_PRESS, XR_HAPTIC_RELEASE, XR_HAPTIC_REPEAT, XR_OP_PRESS, XR_OP_RELEASE, XR_POSE_INPUT, XR_VECTOR2F_INPUT, and XR_VIBRATION_OUTPUT.
Referenced by wm_xr_session_events_dispatch().
|
static |
Definition at line 977 of file wm_xr_session.cc.
References wmXrAction::action_flag, wmXrAction::axis_flags, BLI_assert_unreachable, wmXrAction::count_subaction_paths, wmXrAction::float_thresholds, min_ii(), state, wmXrAction::states, wmXrAction::subaction_paths, test_float_state(), test_vec2f_state(), wmXrAction::type, wm_xr_session_controller_aim_pose_find(), XR_ACTION_BIMANUAL, XR_BOOLEAN_INPUT, XR_FLOAT_INPUT, XR_POSE_INPUT, XR_VECTOR2F_INPUT, and XR_VIBRATION_OUTPUT.
Referenced by wm_xr_session_events_dispatch().
| void wm_xr_session_actions_init | ( | wmXrData * | xr | ) |
Definition at line 584 of file wm_xr_session.cc.
References wmXrRuntimeData::context, and wmXrData::runtime.
Referenced by wm_xr_session_create_cb().
| void wm_xr_session_actions_update | ( | wmWindowManager * | wm | ) |
Definition at line 1187 of file wm_xr_session.cc.
References wmXrRuntimeData::area, XrSessionSettings::base_scale, wmXrRuntimeData::context, wmXrActionSet::controller_aim_action, wmXrActionSet::controller_grip_action, ED_area_offscreen_create(), ListBase::first, mat4_to_loc_quat(), mul_m4_m4m4(), wmXrActionSet::name, View3D::object_type_exclude_select, XrSessionSettings::object_type_exclude_select, View3D::object_type_exclude_viewport, XrSessionSettings::object_type_exclude_viewport, wmXrData::runtime, wmXrData::session_settings, wmXrRuntimeData::session_state, SPACE_VIEW3D, ScrArea::spacedata, state, WM_xr_active_action_set_set(), wm_xr_pose_scale_to_imat(), wm_xr_pose_scale_to_mat(), wm_xr_session_controller_data_update(), wm_xr_session_events_dispatch(), wm_xr_session_root_window_or_fallback_get(), and wmWindowManager::xr.
Referenced by wm_xr_events_handle().
Definition at line 394 of file wm_xr_session.cc.
References wmXrRuntimeData::area, and wmXrData::runtime.
|
static |
Definition at line 161 of file wm_xr_session.cc.
References axis_angle_to_quat_single(), XrSessionSettings::base_pose_angle, XrSessionSettings::base_pose_location, XrSessionSettings::base_pose_object, XrSessionSettings::base_pose_type, XrSessionSettings::base_scale, Scene::camera, copy_v3_fl(), copy_v3_v3(), eul_to_quat(), M_PI_2, mat4_to_loc_quat(), mul_qt_qtqt(), quat_to_eul(), XR_BASE_POSE_CUSTOM, and XR_BASE_POSE_OBJECT.
Referenced by wm_xr_session_draw_data_populate().
| void WM_xr_session_base_pose_reset | ( | wmXrData * | xr | ) |
Definition at line 151 of file wm_xr_session.cc.
References wmXrSessionState::force_reset_to_base_pose, wmXrData::runtime, and wmXrRuntimeData::session_state.
|
static |
Definition at line 109 of file wm_xr_session.cc.
References wm_xr_session_create_cb(), and wm_xr_session_exit_cb().
Referenced by wm_xr_session_toggle().
|
static |
Definition at line 671 of file wm_xr_session.cc.
References BLI_findstring(), controller, offsetof, and state.
Referenced by wm_xr_session_action_test_bimanual(), and wm_xr_session_events_dispatch().
| void wm_xr_session_controller_data_clear | ( | wmXrSessionState * | state | ) |
Definition at line 1289 of file wm_xr_session.cc.
References wmXrSurfaceData::controller_art, wmXrSurfaceData::controller_draw_handle, ED_region_draw_cb_exit(), g_xr_surface, state, and wm_xr_session_controller_data_free().
Referenced by WM_xr_action_destroy(), WM_xr_action_set_destroy(), and WM_xr_active_action_set_set().
|
static |
Definition at line 76 of file wm_xr_session.cc.
References BLI_freelinkN(), BLI_pophead(), GPU_batch_discard(), and state.
Referenced by wm_xr_session_controller_data_clear(), wm_xr_session_controller_data_populate(), and wm_xr_session_data_free().
| void wm_xr_session_controller_data_populate | ( | const wmXrAction * | grip_action, |
| const wmXrAction * | aim_action, | ||
| wmXrData * | xr ) |
Definition at line 1254 of file wm_xr_session.cc.
References BLI_addtail(), BLI_assert, controller, wmXrSurfaceData::controller_art, wmXrSurfaceData::controller_draw_handle, count, wmXrAction::count_subaction_paths, ED_region_draw_cb_activate(), g_xr_surface, i, MEM_callocN(), REGION_DRAW_POST_VIEW, wmXrData::runtime, wmXrRuntimeData::session_state, state, STREQ, STRNCPY(), wmXrAction::subaction_paths, UNUSED_VARS, wm_xr_draw_controllers(), and wm_xr_session_controller_data_free().
Referenced by WM_xr_active_action_set_set(), and WM_xr_controller_pose_actions_set().
|
static |
Definition at line 616 of file wm_xr_session.cc.
References add_v3_v3(), BLI_assert, BLI_listbase_count(), controller, copy_v3_v3(), wmXrAction::count_subaction_paths, XrSessionSettings::flag, LISTBASE_FOREACH_INDEX, state, wmXrAction::states, wm_xr_pose_scale_to_mat(), wm_xr_session_controller_pose_calc(), XR_SESSION_USE_ABSOLUTE_TRACKING, XR_SESSION_USE_POSITION_TRACKING, and zero_v3().
Referenced by wm_xr_session_actions_update().
|
static |
Definition at line 593 of file wm_xr_session.cc.
References mat4_to_loc_quat(), mul_m4_m4m4(), sub_v3_v3(), and wm_xr_pose_to_mat().
Referenced by wm_xr_session_controller_data_update().
|
static |
Definition at line 55 of file wm_xr_session.cc.
References XrSessionSettings::base_scale, BKE_callback_exec_null(), BKE_CB_EVT_XR_SESSION_START_PRE, ListBase::first, G_MAIN, wmXrData::runtime, wmXrData::session_settings, wmXrRuntimeData::session_state, state, Main::wm, wm_xr_session_actions_init(), WM_xr_session_state_navigation_reset(), and wmWindowManager::xr.
Referenced by wm_xr_session_begin_info_create().
| void wm_xr_session_data_free | ( | wmXrSessionState * | state | ) |
Definition at line 87 of file wm_xr_session.cc.
References state, and wm_xr_session_controller_data_free().
Referenced by wm_xr_runtime_data_free().
|
static |
Definition at line 1347 of file wm_xr_session.cc.
References BKE_scene_graph_evaluated_ensure(), C, CTX_data_main(), CTX_wm_manager(), depsgraph, WM_xr_session_is_ready(), wm_xr_session_scene_and_depsgraph_get(), and wmWindowManager::xr.
Referenced by wm_xr_session_surface_create().
|
static |
Definition at line 259 of file wm_xr_session.cc.
References XrSessionSettings::base_pose_object, XrSessionSettings::base_pose_type, XrSessionSettings::flag, state, and XR_SESSION_USE_POSITION_TRACKING.
Referenced by wm_xr_session_state_to_event().
|
static |
Definition at line 199 of file wm_xr_session.cc.
References wmXrDrawData::base_pose, wmXrDrawData::base_scale, depsgraph, wmXrDrawData::depsgraph, g_xr_surface, wmXrDrawData::scene, wmXrData::session_settings, wmXrDrawData::surface_data, wm_xr_session_base_pose_calc(), and wmXrDrawData::xr_data.
Referenced by wm_xr_session_surface_draw().
| void wm_xr_session_draw_data_update | ( | wmXrSessionState * | state, |
| const XrSessionSettings * | settings, | ||
| const GHOST_XrDrawViewInfo * | draw_view, | ||
| wmXrDrawData * | draw_data ) |
Definition at line 290 of file wm_xr_session.cc.
References copy_v3_fl(), copy_v3_v3(), wmXrDrawData::eye_position_ofs, XrSessionSettings::flag, SESSION_STATE_EVENT_NONE, SESSION_STATE_EVENT_POSITION_TRACKING_TOGGLE, SESSION_STATE_EVENT_RESET_TO_BASE_POSE, SESSION_STATE_EVENT_START, state, WM_xr_session_state_navigation_reset(), wm_xr_session_state_to_event(), and XR_SESSION_USE_POSITION_TRACKING.
Referenced by wm_xr_draw_view().
|
static |
Definition at line 1035 of file wm_xr_session.cc.
References BLI_assert_unreachable, copy_qt_qt(), copy_v2_v2(), copy_v3_v3(), data, wmXrAction::float_thresholds, MEM_callocN(), wmXrAction::name, wmXrAction::op_properties, wmXrAction::ot, wmXrAction::states, STRNCPY(), wmXrAction::subaction_paths, wmXrAction::type, XR_BOOLEAN_INPUT, XR_FLOAT_INPUT, XR_POSE_INPUT, XR_VECTOR2F_INPUT, and XR_VIBRATION_OUTPUT.
Referenced by wm_xr_session_events_dispatch().
|
static |
Definition at line 1105 of file wm_xr_session.cc.
References wmXrActionSet::active_haptic_actions, wmXrActionSet::active_modal_actions, wmXrAction::active_modal_path, BLI_time_now_seconds(), count, wmXrAction::count_subaction_paths, wmXrAction::haptic_name, KM_NOTHING, MEM_calloc_arrayN(), MEM_freeN(), wmOperatorType::modal, wmXrActionSet::name, wmXrAction::ot, wmXrAction::subaction_paths, wm_xr_session_action_states_interpret(), wm_xr_session_action_test_bimanual(), wm_xr_session_controller_aim_pose_find(), wm_xr_session_event_create(), wm_xr_session_haptic_timers_check(), and wm_xr_session_modal_action_test().
Referenced by wm_xr_session_actions_update().
| bool WM_xr_session_exists | ( | const wmXrData * | xr | ) |
Definition at line 146 of file wm_xr_session.cc.
References wmXrRuntimeData::context, wmXrSessionState::is_started, wmXrData::runtime, and wmXrRuntimeData::session_state.
Referenced by WM_xr_session_is_ready(), WM_xr_session_state_nav_location_set(), WM_xr_session_state_nav_rotation_set(), WM_xr_session_state_nav_scale_set(), wm_xr_session_toggle(), and wm_xr_session_update_screen().
|
static |
Definition at line 92 of file wm_xr_session.cc.
References wmXrRuntimeData::exit_fn, wmXrSessionState::is_started, wmXrData::runtime, wmXrRuntimeData::session_state, and wm_xr_runtime_data_free().
Referenced by wm_xr_session_begin_info_create().
| void * wm_xr_session_gpu_binding_context_create | ( | ) |
Definition at line 1492 of file wm_xr_session.cc.
References NC_WM, ND_XR_DATA_CHANGED, wmSurface::system_gpu_context, WM_main_add_notifier(), wm_surface_add(), and wm_xr_session_surface_create().
Referenced by wm_xr_init().
| void wm_xr_session_gpu_binding_context_destroy | ( | GHOST_ContextHandle | context | ) |
Definition at line 1505 of file wm_xr_session.cc.
References g_xr_surface, NC_WM, ND_XR_DATA_CHANGED, WM_main_add_notifier(), wm_surface_remove(), and wm_window_reset_drawable().
Referenced by wm_xr_init().
|
static |
Definition at line 786 of file wm_xr_session.cc.
References wmXrHapticAction::action, BLI_addtail(), MEM_callocN(), wmXrHapticAction::subaction_path, wmXrHapticAction::time_start, and wm_xr_session_haptic_action_find().
Referenced by wm_xr_session_action_states_interpret().
|
static |
Definition at line 774 of file wm_xr_session.cc.
References LISTBASE_FOREACH.
Referenced by wm_xr_session_action_states_interpret(), and wm_xr_session_haptic_action_add().
|
static |
Definition at line 806 of file wm_xr_session.cc.
References BLI_freelinkN(), and LISTBASE_FOREACH.
Referenced by wm_xr_session_action_states_interpret().
|
static |
Definition at line 817 of file wm_xr_session.cc.
References BLI_freelinkN(), and LISTBASE_FOREACH_MUTABLE.
Referenced by wm_xr_session_events_dispatch().
| bool WM_xr_session_is_ready | ( | const wmXrData * | xr | ) |
Definition at line 156 of file wm_xr_session.cc.
References wmXrRuntimeData::context, wmXrData::runtime, and WM_xr_session_exists().
Referenced by wm_xr_draw_view(), wm_xr_events_handle(), wm_xr_operator_sessionactive(), wm_xr_session_do_depsgraph(), WM_xr_session_state_controller_aim_location_get(), WM_xr_session_state_controller_aim_rotation_get(), WM_xr_session_state_controller_grip_location_get(), WM_xr_session_state_controller_grip_rotation_get(), WM_xr_session_state_nav_location_get(), WM_xr_session_state_nav_rotation_get(), WM_xr_session_state_nav_scale_get(), WM_xr_session_state_viewer_pose_location_get(), WM_xr_session_state_viewer_pose_matrix_info_get(), WM_xr_session_state_viewer_pose_rotation_get(), and wm_xr_session_surface_draw().
|
static |
Definition at line 763 of file wm_xr_session.cc.
References BLI_freelinkN(), and LISTBASE_FOREACH.
Referenced by wm_xr_session_action_states_interpret().
|
static |
Definition at line 724 of file wm_xr_session.cc.
References IDP_EqualsProperties(), LISTBASE_FOREACH, wmXrAction::op_properties, and wmXrAction::ot.
Referenced by wm_xr_session_events_dispatch(), and wm_xr_session_modal_action_test_add().
|
static |
Definition at line 752 of file wm_xr_session.cc.
References BLI_addtail(), LinkData::data, MEM_callocN(), and wm_xr_session_modal_action_test().
Referenced by wm_xr_session_action_states_interpret().
| wmWindow * wm_xr_session_root_window_or_fallback_get | ( | const wmWindowManager * | wm, |
| const wmXrRuntimeData * | runtime_data ) |
Definition at line 216 of file wm_xr_session.cc.
References BLI_findindex(), ListBase::first, wmXrRuntimeData::session_root_win, and wmWindowManager::windows.
Referenced by wm_xr_runtime_data_free(), wm_xr_session_actions_update(), and wm_xr_session_scene_and_depsgraph_get().
|
static |
Get the scene and depsgraph shown in the VR session's root window (the window the session was started from) if still available. If it's not available, use some fallback window.
It's important that the VR session follows some existing window, otherwise it would need to have its own depsgraph, which is an expense we should avoid.
Definition at line 236 of file wm_xr_session.cc.
References BKE_scene_get_depsgraph(), BLI_assert, depsgraph, wmXrData::runtime, WM_window_get_active_scene(), WM_window_get_active_view_layer(), wm_xr_session_root_window_or_fallback_get(), and wmWindowManager::xr.
Referenced by wm_xr_session_do_depsgraph(), and wm_xr_session_surface_draw().
| bool WM_xr_session_state_controller_aim_location_get | ( | const wmXrData * | xr, |
| uint | subaction_idx, | ||
| float | r_location[3] ) |
Definition at line 473 of file wm_xr_session.cc.
References BLI_assert, BLI_findlink(), BLI_listbase_count(), controller, wmXrSessionState::controllers, copy_v3_v3(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, WM_xr_session_is_ready(), and zero_v3().
| bool WM_xr_session_state_controller_aim_rotation_get | ( | const wmXrData * | xr, |
| uint | subaction_idx, | ||
| float | r_rotation[4] ) |
Definition at line 491 of file wm_xr_session.cc.
References BLI_assert, BLI_findlink(), BLI_listbase_count(), controller, wmXrSessionState::controllers, copy_qt_qt(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, unit_qt(), and WM_xr_session_is_ready().
| bool WM_xr_session_state_controller_grip_location_get | ( | const wmXrData * | xr, |
| uint | subaction_idx, | ||
| float | r_location[3] ) |
Definition at line 437 of file wm_xr_session.cc.
References BLI_assert, BLI_findlink(), BLI_listbase_count(), controller, wmXrSessionState::controllers, copy_v3_v3(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, WM_xr_session_is_ready(), and zero_v3().
| bool WM_xr_session_state_controller_grip_rotation_get | ( | const wmXrData * | xr, |
| uint | subaction_idx, | ||
| float | r_rotation[4] ) |
Definition at line 455 of file wm_xr_session.cc.
References BLI_assert, BLI_findlink(), BLI_listbase_count(), controller, wmXrSessionState::controllers, copy_qt_qt(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, unit_qt(), and WM_xr_session_is_ready().
| wmXrSessionState * WM_xr_session_state_handle_get | ( | const wmXrData * | xr | ) |
Definition at line 389 of file wm_xr_session.cc.
References wmXrData::runtime, and wmXrRuntimeData::session_state.
| bool WM_xr_session_state_nav_location_get | ( | const wmXrData * | xr, |
| float | r_location[3] ) |
Definition at line 509 of file wm_xr_session.cc.
References copy_v3_v3(), wmXrSessionState::is_view_data_set, wmXrSessionState::nav_pose, wmXrData::runtime, wmXrRuntimeData::session_state, WM_xr_session_is_ready(), and zero_v3().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_grab_apply(), wm_xr_navigation_reset_exec(), and wm_xr_navigation_teleport().
| void WM_xr_session_state_nav_location_set | ( | wmXrData * | xr, |
| const float | location[3] ) |
Definition at line 520 of file wm_xr_session.cc.
References copy_v3_v3(), wmXrSessionState::is_navigation_dirty, wmXrSessionState::nav_pose, wmXrData::runtime, wmXrRuntimeData::session_state, and WM_xr_session_exists().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_grab_apply(), wm_xr_navigation_reset_exec(), and wm_xr_navigation_teleport().
| bool WM_xr_session_state_nav_rotation_get | ( | const wmXrData * | xr, |
| float | r_rotation[4] ) |
Definition at line 528 of file wm_xr_session.cc.
References copy_qt_qt(), wmXrSessionState::is_view_data_set, wmXrSessionState::nav_pose, wmXrData::runtime, wmXrRuntimeData::session_state, unit_qt(), and WM_xr_session_is_ready().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_grab_apply(), wm_xr_navigation_reset_exec(), and wm_xr_navigation_teleport().
| void WM_xr_session_state_nav_rotation_set | ( | wmXrData * | xr, |
| const float | rotation[4] ) |
Definition at line 539 of file wm_xr_session.cc.
References BLI_ASSERT_UNIT_QUAT, copy_qt_qt(), wmXrSessionState::is_navigation_dirty, wmXrSessionState::nav_pose, wmXrData::runtime, wmXrRuntimeData::session_state, and WM_xr_session_exists().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_grab_apply(), and wm_xr_navigation_reset_exec().
| bool WM_xr_session_state_nav_scale_get | ( | const wmXrData * | xr, |
| float * | r_scale ) |
Definition at line 548 of file wm_xr_session.cc.
References wmXrSessionState::is_view_data_set, wmXrSessionState::nav_scale, wmXrData::runtime, wmXrRuntimeData::session_state, and WM_xr_session_is_ready().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_grab_apply(), and wm_xr_navigation_reset_exec().
| void WM_xr_session_state_nav_scale_set | ( | wmXrData * | xr, |
| float | scale ) |
Definition at line 559 of file wm_xr_session.cc.
References CLAMP, XrSessionSettings::clip_end, XrSessionSettings::clip_start, wmXrSessionState::is_navigation_dirty, wmXrSessionState::nav_scale, wmXrData::runtime, wmXrData::session_settings, wmXrRuntimeData::session_state, and WM_xr_session_exists().
Referenced by wm_xr_navigation_grab_apply(), and wm_xr_navigation_reset_exec().
| void WM_xr_session_state_navigation_reset | ( | wmXrSessionState * | state | ) |
Definition at line 569 of file wm_xr_session.cc.
References state, unit_qt(), and zero_v3().
Referenced by wm_xr_session_create_cb(), and wm_xr_session_draw_data_update().
|
static |
Definition at line 270 of file wm_xr_session.cc.
References XrSessionSettings::flag, SESSION_STATE_EVENT_NONE, SESSION_STATE_EVENT_POSITION_TRACKING_TOGGLE, SESSION_STATE_EVENT_RESET_TO_BASE_POSE, SESSION_STATE_EVENT_START, state, wm_xr_session_draw_data_needs_reset_to_base_pose(), and XR_SESSION_USE_POSITION_TRACKING.
Referenced by wm_xr_session_draw_data_update().
| void wm_xr_session_state_update | ( | const XrSessionSettings * | settings, |
| const wmXrDrawData * | draw_data, | ||
| const GHOST_XrDrawViewInfo * | draw_view, | ||
| wmXrSessionState * | state ) |
Update information that is only stored for external state queries. E.g. for Python API to request the current (as in, last known) viewer pose. Controller data and action sets will be updated separately via wm_xr_session_actions_update().
Definition at line 338 of file wm_xr_session.cc.
References wmXrDrawData::base_pose, XrSessionSettings::base_pose_object, XrSessionSettings::base_pose_type, wmXrDrawData::base_scale, copy_qt_qt(), copy_v3_v3(), DEFAULT_SENSOR_WIDTH, wmXrDrawData::eye_position_ofs, XrSessionSettings::flag, fov_to_focallength(), mat4_to_loc_quat(), mul_m4_m4m4(), state, sub_v3_v3(), wm_xr_pose_scale_to_imat(), wm_xr_pose_scale_to_mat(), wm_xr_pose_to_mat(), XR_SESSION_USE_ABSOLUTE_TRACKING, XR_SESSION_USE_POSITION_TRACKING, and zero_v3().
Referenced by wm_xr_draw_view().
| bool WM_xr_session_state_viewer_pose_location_get | ( | const wmXrData * | xr, |
| float | r_location[3] ) |
Definition at line 399 of file wm_xr_session.cc.
References copy_v3_v3(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, wmXrSessionState::viewer_pose, WM_xr_session_is_ready(), and zero_v3().
Referenced by wm_xr_navigation_fly_modal(), wm_xr_navigation_teleport(), and wm_xr_raycast_update().
| bool WM_xr_session_state_viewer_pose_matrix_info_get | ( | const wmXrData * | xr, |
| float | r_viewmat[4][4], | ||
| float * | r_focal_len ) |
Definition at line 421 of file wm_xr_session.cc.
References copy_m4_m4(), wmXrSessionState::focal_len, wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, unit_m4(), wmXrSessionState::viewer_viewmat, and WM_xr_session_is_ready().
| bool WM_xr_session_state_viewer_pose_rotation_get | ( | const wmXrData * | xr, |
| float | r_rotation[4] ) |
Definition at line 410 of file wm_xr_session.cc.
References copy_v4_v4(), wmXrSessionState::is_view_data_set, wmXrData::runtime, wmXrRuntimeData::session_state, unit_qt(), wmXrSessionState::viewer_pose, and WM_xr_session_is_ready().
Referenced by wm_xr_fly_init(), wm_xr_navigation_fly_modal(), and wm_xr_raycast_update().
|
static |
Definition at line 1464 of file wm_xr_session.cc.
References wmSurface::activate, wmSurface::blender_gpu_context, BLI_assert, wmSurface::customdata, data, wmSurface::deactivate, wmSurface::do_depsgraph, wmSurface::draw, wmSurface::free_data, g_xr_surface, MEM_callocN(), RGN_TYPE_XR, wmSurface::system_gpu_context, wm_xr_session_do_depsgraph(), wm_xr_session_surface_draw(), and wm_xr_session_surface_free_data().
Referenced by wm_xr_session_gpu_binding_context_create().
|
static |
Call Ghost-XR to draw a frame.
Draw callback for the XR-session surface. It's expected to be called on each main loop iteration and tells Ghost-XR to submit a new frame by drawing its views. Note that for drawing each view, wm_xr_draw_view() will be called through Ghost-XR (see GHOST_XrDrawViewFunc()).
Definition at line 1322 of file wm_xr_session.cc.
References C, wmXrRuntimeData::context, CTX_wm_manager(), depsgraph, GPU_framebuffer_active_get(), GPU_framebuffer_restore(), wmXrData::runtime, wm_xr_session_draw_data_populate(), WM_xr_session_is_ready(), wm_xr_session_scene_and_depsgraph_get(), and wmWindowManager::xr.
Referenced by wm_xr_session_surface_create().
|
static |
Definition at line 1439 of file wm_xr_session.cc.
References BLI_freelinkN(), BLI_freelistN(), BLI_pophead(), wmSurface::customdata, data, g_xr_surface, GPU_offscreen_free(), GPU_viewport_free(), and MEM_freeN().
Referenced by wm_xr_session_surface_create().
| bool wm_xr_session_surface_offscreen_ensure | ( | wmXrSurfaceData * | surface_data, |
| const GHOST_XrDrawViewInfo * | draw_view ) |
Definition at line 1361 of file wm_xr_session.cc.
References BLI_addtail(), BLI_assert, BLI_findlink(), BLI_listbase_count(), CLOG_ERROR, GPU_offscreen_create(), GPU_offscreen_free(), GPU_offscreen_height(), GPU_offscreen_width(), GPU_R8, GPU_RGB10_A2, GPU_RGBA16, GPU_RGBA16F, GPU_RGBA8, GPU_TEXTURE_USAGE_MEMORY_EXPORT, GPU_TEXTURE_USAGE_SHADER_READ, GPU_viewport_create(), GPU_viewport_free(), LOG, MEM_callocN(), wmXrViewportPair::offscreen, wmXrViewportPair::viewport, and wmXrSurfaceData::viewports.
Referenced by wm_xr_draw_view().
| void wm_xr_session_toggle | ( | wmWindowManager * | wm, |
| wmWindow * | session_root_win, | ||
| wmXrSessionExitFn | session_exit_fn ) |
Definition at line 122 of file wm_xr_session.cc.
References wmXrRuntimeData::context, wmXrRuntimeData::exit_fn, wmXrSessionState::is_started, wmXrData::runtime, wmXrRuntimeData::session_root_win, wmXrRuntimeData::session_state, wm_xr_session_begin_info_create(), WM_xr_session_exists(), and wmWindowManager::xr.
Referenced by wm_xr_session_toggle_exec().
| ARegionType * WM_xr_surface_controller_region_type_get | ( | ) |
Definition at line 1518 of file wm_xr_session.cc.
References data, and g_xr_surface.
Referenced by drw_callbacks_post_scene().
Definition at line 50 of file wm_xr_session.cc.
Referenced by wm_xr_session_controller_data_clear(), wm_xr_session_controller_data_populate(), wm_xr_session_draw_data_populate(), wm_xr_session_gpu_binding_context_destroy(), wm_xr_session_surface_create(), wm_xr_session_surface_free_data(), and WM_xr_surface_controller_region_type_get().
|
static |
Definition at line 51 of file wm_xr_session.cc.