34 action_set->
name =
MEM_mallocN(strlen(action_set_name) + 1,
"XrActionSet_Name");
35 strcpy(action_set->
name, action_set_name);
54 return GHOST_XrGetActionSetCustomdata(xr->
runtime->
context, action_set_name);
62 const char *haptic_name,
64 const float *haptic_frequency,
65 const float *haptic_amplitude,
72 strcpy(action->
name, action_name);
76 unsigned int subaction_idx = 0;
80 "XrAction_SubactionPaths");
83 "XrAction_SubactionPath");
99 size =
sizeof(GHOST_XrPose);
109 if (is_float_action) {
113 if (is_button_action) {
144 if (subaction_paths) {
164 return GHOST_XrGetActionCustomdata(xr->
runtime->
context, action_set_name, action_name);
175 GHOST_XrActionSetInfo info = {
176 .name = action_set_name,
178 .customdata = action_set,
213 const char *action_set_name,
214 const char *action_name,
219 const char *haptic_name,
220 const int64_t *haptic_duration,
221 const float *haptic_frequency,
222 const float *haptic_amplitude,
227 if (
action_find(xr, action_set_name, action_name)) {
245 unsigned int subaction_idx = 0;
248 count,
sizeof(*subaction_paths),
"XrAction_SubactionPathPointers");
251 subaction_paths[subaction_idx] = (
char *)user_path->path;
254 GHOST_XrActionInfo info = {
256 .count_subaction_paths =
count,
257 .subaction_paths = (
const char **)subaction_paths,
262 .customdata = action,
267 info.type = GHOST_kXrActionTypeBooleanInput;
270 info.type = GHOST_kXrActionTypeFloatInput;
273 info.type = GHOST_kXrActionTypeVector2fInput;
276 info.type = GHOST_kXrActionTypePoseInput;
279 info.type = GHOST_kXrActionTypeVibrationOutput;
283 const bool success = GHOST_XrCreateActions(xr->
runtime->
context, action_set_name, 1, &info);
314 if (
STREQ(active_modal_action->
name, action_name)) {
321 if (
STREQ(ha->action->name, action_name)) {
326 GHOST_XrDestroyActions(xr->
runtime->
context, action_set_name, 1, &action_name);
330 const char *action_set_name,
331 const char *action_name,
332 const char *profile_path,
335 const float *float_thresholds,
337 const struct wmXrPose *poses)
343 count,
sizeof(*binding_infos),
"XrActionBinding_Infos");
346 count,
sizeof(*subaction_paths),
"XrActionBinding_SubactionPathPointers");
348 for (
unsigned int i = 0; i <
count; ++i) {
349 GHOST_XrActionBindingInfo *binding_info = &binding_infos[i];
353 subaction_paths[i] = (
char *)user_path->
path;
355 binding_info->component_path = component_path->
path;
356 if (float_thresholds) {
357 binding_info->float_threshold = float_thresholds[i];
360 binding_info->axis_flag = axis_flags[i];
363 copy_v3_v3(binding_info->pose.position, poses[i].position);
364 copy_qt_qt(binding_info->pose.orientation_quat, poses[i].orientation_quat);
368 GHOST_XrActionProfileInfo profile_info = {
369 .action_name = action_name,
370 .profile_path = profile_path,
371 .count_subaction_paths =
count,
372 .subaction_paths = (
const char **)subaction_paths,
373 .bindings = binding_infos,
376 const bool success = GHOST_XrCreateActionBindings(
386 const char *action_set_name,
387 const char *action_name,
388 const char *profile_path)
390 GHOST_XrDestroyActionBindings(
391 xr->
runtime->
context, action_set_name, 1, &action_name, &profile_path);
411 if (active_action_set) {
431 const char *action_set_name,
432 const char *grip_action_name,
433 const char *aim_action_name)
456 for (
unsigned int i = 0; i <
count; ++i) {
473 const char *action_set_name,
474 const char *action_name,
475 const char *subaction_path,
476 wmXrActionState *r_state)
483 r_state->type = (int)action->
type;
488 switch (action->
type) {
490 r_state->state_boolean = ((
bool *)action->
states)[i];
493 r_state->state_float = ((
float *)action->
states)[i];
499 const GHOST_XrPose *pose = &((GHOST_XrPose *)action->
states)[i];
500 copy_v3_v3(r_state->state_pose.position, pose->position);
501 copy_qt_qt(r_state->state_pose.orientation_quat, pose->orientation_quat);
516 const char *action_set_name,
517 const char *action_name,
518 const char *subaction_path,
520 const float *frequency,
521 const float *amplitude)
535 const char *action_set_name,
536 const char *action_name,
537 const char *subaction_path)
539 GHOST_XrStopHapticAction(xr->
runtime->
context, action_set_name, action_name, subaction_path);
typedef float(TangentPoint)[2]
#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)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT 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])
GHOST C-API function and type declarations.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(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
static wmXrActionSet * action_set_find(wmXrData *xr, const char *action_set_name)
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_find(wmXrData *xr, const char *action_set_name, const char *action_name)
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 struct wmXrPose *poses)
static wmXrActionSet * action_set_create(const char *action_set_name)
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)
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)
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 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)
static void action_set_destroy(void *val)
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)