Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_get_state.c File Reference

Holds action state get related functions. More...

#include "oxr_get_state.h"
#include "oxr_subaction.h"
#include "oxr_input.h"
#include "../oxr_objects.h"
#include "../oxr_logger.h"
Include dependency graph for oxr_get_state.c:

Macros

#define OXR_ACTION_GET_XR_STATE_FROM_ACTION_STATE_COMMON(ACTION_STATE, DATA)
 
#define OXR_ACTION_GET_FILLER(TYPE)
 This populates the internals of action get state functions.
 
#define OXR_ACTION_RESET_XR_ACTION_STATE(data)
 Clear the actual data members of the XrActionState* types, to have the correct return value in case of the action being not active.
 
#define COMPUTE_ACTIVE(X)
 

Functions

static void get_xr_state_from_action_state_bool (struct oxr_instance *inst, struct oxr_action_state *state, XrActionStateBoolean *data)
 
static void get_xr_state_from_action_state_vec1 (struct oxr_instance *inst, struct oxr_action_state *state, XrActionStateFloat *data)
 
static void get_xr_state_from_action_state_vec2 (struct oxr_instance *inst, struct oxr_action_state *state, XrActionStateVector2f *data)
 
XrResult oxr_action_get_boolean (struct oxr_logger *log, struct oxr_session *sess, uint32_t act_key, struct oxr_subaction_paths subaction_paths, XrActionStateBoolean *data)
 
XrResult oxr_action_get_vector1f (struct oxr_logger *log, struct oxr_session *sess, uint32_t act_key, struct oxr_subaction_paths subaction_paths, XrActionStateFloat *data)
 
XrResult oxr_action_get_vector2f (struct oxr_logger *log, struct oxr_session *sess, uint32_t act_key, struct oxr_subaction_paths subaction_paths, XrActionStateVector2f *data)
 
XrResult oxr_action_get_pose (struct oxr_logger *log, struct oxr_session *sess, uint32_t act_key, struct oxr_subaction_paths subaction_paths, XrActionStatePose *data)
 

Detailed Description

Holds action state get related functions.

Macro Definition Documentation

◆ COMPUTE_ACTIVE

#define COMPUTE_ACTIVE (   X)
Value:
if (subaction_paths.X) { \
data->isActive |= act_attached->X.current.active; \
}

◆ OXR_ACTION_GET_FILLER

#define OXR_ACTION_GET_FILLER (   TYPE)
Value:
if (subaction_paths.any && act_attached->any_state.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->any_state, data); \
} \
if (subaction_paths.user && act_attached->user.current.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->user.current, data); \
} \
if (subaction_paths.head && act_attached->head.current.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->head.current, data); \
} \
if (subaction_paths.left && act_attached->left.current.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->left.current, data); \
} \
if (subaction_paths.right && act_attached->right.current.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->right.current, data); \
} \
if (subaction_paths.gamepad && act_attached->gamepad.current.active) { \
get_xr_state_from_action_state_##TYPE(sess->sys->inst, &act_attached->gamepad.current, data); \
}

This populates the internals of action get state functions.

Note
Keep this synchronized with OXR_FOR_EACH_SUBACTION_PATH!

◆ OXR_ACTION_GET_XR_STATE_FROM_ACTION_STATE_COMMON

#define OXR_ACTION_GET_XR_STATE_FROM_ACTION_STATE_COMMON (   ACTION_STATE,
  DATA 
)
Value:
do { \
DATA->lastChangeTime = time_state_monotonic_to_ts_ns(inst->timekeeping, ACTION_STATE->timestamp); \
DATA->changedSinceLastSync = ACTION_STATE->changed; \
DATA->isActive = XR_TRUE; \
} while (0)

◆ OXR_ACTION_RESET_XR_ACTION_STATE

#define OXR_ACTION_RESET_XR_ACTION_STATE (   data)
Value:
do { \
data->isActive = XR_FALSE; \
data->changedSinceLastSync = XR_FALSE; \
data->lastChangeTime = 0; \
U_ZERO(&data->currentState); \
} while (0)

Clear the actual data members of the XrActionState* types, to have the correct return value in case of the action being not active.