61 GHOST_XrGetActionSetCustomdata(xr->
runtime->
context, action_set_name));
69 const char *haptic_name,
71 const float *haptic_frequency,
72 const float *haptic_amplitude,
82 uint subaction_idx = 0;
100 size =
sizeof(
float) * 2;
103 size =
sizeof(GHOST_XrPose);
112 const bool is_button_action = (is_float_action || type ==
XR_BOOLEAN_INPUT);
113 if (is_float_action) {
117 if (is_button_action) {
147 if (subaction_paths) {
168 GHOST_XrGetActionCustomdata(xr->
runtime->
context, action_set_name, action_name));
179 GHOST_XrActionSetInfo info{};
180 info.name = action_set_name;
182 info.customdata = action_set;
216 const char *action_set_name,
217 const char *action_name,
222 const char *haptic_name,
223 const int64_t *haptic_duration,
224 const float *haptic_frequency,
225 const float *haptic_amplitude,
230 if (
action_find(xr, action_set_name, action_name)) {
248 uint subaction_idx = 0;
250 char **subaction_paths =
static_cast<char **
>(
254 subaction_paths[subaction_idx] = (
char *)user_path->path;
257 GHOST_XrActionInfo info{};
258 info.name = action_name;
259 info.count_subaction_paths =
count;
260 info.subaction_paths = (
const char **)subaction_paths;
261 info.states = action->
states;
265 info.customdata = action;
269 info.
type = GHOST_kXrActionTypeBooleanInput;
272 info.type = GHOST_kXrActionTypeFloatInput;
275 info.type = GHOST_kXrActionTypeVector2fInput;
278 info.type = GHOST_kXrActionTypePoseInput;
281 info.type = GHOST_kXrActionTypeVibrationOutput;
285 const bool success = GHOST_XrCreateActions(xr->
runtime->
context, action_set_name, 1, &info);
317 if (
STREQ(active_modal_action->
name, action_name)) {
324 if (
STREQ(ha->action->name, action_name)) {
329 GHOST_XrDestroyActions(xr->
runtime->
context, action_set_name, 1, &action_name);
333 const char *action_set_name,
334 const char *action_name,
335 const char *profile_path,
338 const float *float_thresholds,
340 const wmXrPose *poses)
345 GHOST_XrActionBindingInfo *binding_infos =
static_cast<GHOST_XrActionBindingInfo *
>(
348 char **subaction_paths =
static_cast<char **
>(
352 GHOST_XrActionBindingInfo *binding_info = &binding_infos[i];
357 subaction_paths[i] = (
char *)user_path->
path;
359 binding_info->component_path = component_path->
path;
360 if (float_thresholds) {
361 binding_info->float_threshold = float_thresholds[i];
364 binding_info->axis_flag = axis_flags[i];
367 copy_v3_v3(binding_info->pose.position, poses[i].position);
368 copy_qt_qt(binding_info->pose.orientation_quat, poses[i].orientation_quat);
372 GHOST_XrActionProfileInfo profile_info{};
373 profile_info.action_name = action_name;
374 profile_info.profile_path = profile_path;
375 profile_info.count_subaction_paths =
count;
376 profile_info.subaction_paths = (
const char **)subaction_paths;
377 profile_info.bindings = binding_infos;
379 const bool success = GHOST_XrCreateActionBindings(
389 const char *action_set_name,
390 const char *action_name,
391 const char *profile_path)
393 GHOST_XrDestroyActionBindings(
394 xr->
runtime->
context, action_set_name, 1, &action_name, &profile_path);
414 if (active_action_set) {
434 const char *action_set_name,
435 const char *grip_action_name,
436 const char *aim_action_name)
476 const char *action_set_name,
477 const char *action_name,
478 const char *subaction_path,
479 wmXrActionState *r_state)
486 r_state->type =
int(action->
type);
491 switch (action->
type) {
493 r_state->state_boolean = ((
bool *)action->
states)[i];
496 r_state->state_float = ((
float *)action->
states)[i];
502 const GHOST_XrPose *pose = &((GHOST_XrPose *)action->
states)[i];
503 copy_v3_v3(r_state->state_pose.position, pose->position);
504 copy_qt_qt(r_state->state_pose.orientation_quat, pose->orientation_quat);
519 const char *action_set_name,
520 const char *action_name,
521 const char *subaction_path,
523 const float *frequency,
524 const float *amplitude)
538 const char *action_set_name,
539 const char *action_name,
540 const char *subaction_path)
542 GHOST_XrStopHapticAction(xr->
runtime->
context, action_set_name, action_name, subaction_path);
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void copy_qt_qt(float q[4], const float a[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define STRNCPY(dst, src)
GHOST C-API function and type declarations.
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_mallocN)(size_t len, const char *str)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
wmXrAction * controller_aim_action
wmXrAction * controller_grip_action
ListBase active_modal_actions
ListBase active_haptic_actions
struct wmOperatorType * ot
unsigned int count_subaction_paths
eXrActionFlag action_flag
eXrHapticFlag haptic_flag
IDProperty * op_properties
struct wmXrRuntimeData * runtime
GHOST_XrContextHandle context
wmXrSessionState session_state
char active_action_set_next[64]
struct wmXrActionSet * active_action_set
bool WM_xr_action_state_get(const wmXrData *xr, const char *action_set_name, const char *action_name, const char *subaction_path, wmXrActionState *r_state)
static wmXrAction * action_create(const char *action_name, eXrActionType type, const ListBase *user_paths, wmOperatorType *ot, IDProperty *op_properties, const char *haptic_name, const int64_t *haptic_duration, const float *haptic_frequency, const float *haptic_amplitude, eXrOpFlag op_flag, eXrActionFlag action_flag, eXrHapticFlag haptic_flag)
bool WM_xr_action_binding_create(wmXrData *xr, const char *action_set_name, const char *action_name, const char *profile_path, const ListBase *user_paths, const ListBase *component_paths, const float *float_thresholds, const eXrAxisFlag *axis_flags, const wmXrPose *poses)
void WM_xr_action_destroy(wmXrData *xr, const char *action_set_name, const char *action_name)
void WM_xr_haptic_action_stop(wmXrData *xr, const char *action_set_name, const char *action_name, const char *subaction_path)
bool WM_xr_action_set_create(wmXrData *xr, const char *action_set_name)
void WM_xr_action_binding_destroy(wmXrData *xr, const char *action_set_name, const char *action_name, const char *profile_path)
static wmXrActionSet * action_set_find(wmXrData *xr, const char *action_set_name)
bool WM_xr_action_create(wmXrData *xr, const char *action_set_name, const char *action_name, eXrActionType type, const ListBase *user_paths, wmOperatorType *ot, IDProperty *op_properties, const char *haptic_name, const int64_t *haptic_duration, const float *haptic_frequency, const float *haptic_amplitude, eXrOpFlag op_flag, eXrActionFlag action_flag, eXrHapticFlag haptic_flag)
static wmXrActionSet * action_set_create(const char *action_set_name)
void WM_xr_action_set_destroy(wmXrData *xr, const char *action_set_name)
bool WM_xr_controller_pose_actions_set(wmXrData *xr, const char *action_set_name, const char *grip_action_name, const char *aim_action_name)
static void action_set_destroy(void *val)
static wmXrAction * action_find(wmXrData *xr, const char *action_set_name, const char *action_name)
static void action_destroy(void *val)
bool WM_xr_haptic_action_apply(wmXrData *xr, const char *action_set_name, const char *action_name, const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude)
bool WM_xr_active_action_set_set(wmXrData *xr, const char *action_set_name, bool delayed)
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)