Monado OpenXR Runtime
|
Files | |
file | oxr_input_transform.c |
Handles transformation/filtering of input data. | |
file | oxr_input_transform.h |
Defines ways of performing (possibly multi-step) conversions of input data. | |
Data Structures | |
struct | oxr_input_transform_threshold_data |
Data required for INPUT_TRANSFORM_THRESHOLD. More... | |
struct | oxr_input_transform_bool_to_vec1_data |
Data required for INPUT_TRANSFORM_BOOL_TO_VEC1. More... | |
struct | oxr_input_transform_dpad_data |
Data required for INPUT_TRANSFORM_DPAD. More... | |
struct | oxr_input_transform |
Variant type for input transforms. More... | |
struct | oxr_input_value_tagged |
An input value enum with the associated tag required to interpret it. More... | |
Enumerations | |
enum | oxr_input_transform_type { INPUT_TRANSFORM_INVALID = 0 , INPUT_TRANSFORM_IDENTITY , INPUT_TRANSFORM_VEC2_GET_X , INPUT_TRANSFORM_VEC2_GET_Y , INPUT_TRANSFORM_THRESHOLD , INPUT_TRANSFORM_BOOL_TO_VEC1 , INPUT_TRANSFORM_DPAD } |
Tag for the input transform. More... | |
Functions | |
void | oxr_input_transform::oxr_input_transform_destroy (struct oxr_input_transform **transform_ptr) |
Destroy an array of input transforms. More... | |
bool | oxr_input_transform::oxr_input_transform_process (struct oxr_input_transform *transforms, size_t transform_count, const struct oxr_input_value_tagged *input, struct oxr_input_value_tagged *out) |
Apply an array of input transforms. More... | |
bool | oxr_input_transform::oxr_input_transform_init_root (struct oxr_input_transform *transform, enum xrt_input_type input_type) |
Allocate an identity transform serving as the root/head of the transform chain. More... | |
bool | oxr_input_transform::oxr_input_transform_init_vec2_get_x (struct oxr_input_transform *transform, const struct oxr_input_transform *parent) |
Allocate a transform to get the X component of a Vec2. More... | |
bool | oxr_input_transform::oxr_input_transform_init_vec2_get_y (struct oxr_input_transform *transform, const struct oxr_input_transform *parent) |
Allocate a transform to get the Y component of a Vec2. More... | |
bool | oxr_input_transform::oxr_input_transform_init_threshold (struct oxr_input_transform *transform, const struct oxr_input_transform *parent, float threshold, bool invert) |
Allocate a transform to threshold a float to a bool. More... | |
bool | oxr_input_transform::oxr_input_transform_init_bool_to_vec1 (struct oxr_input_transform *transform, const struct oxr_input_transform *parent, enum xrt_input_type result_type, float true_val, float false_val) |
Allocate a transform to turn a bool into an arbitrary 1D float. More... | |
bool | oxr_input_transform_create_chain (struct oxr_logger *log, struct oxr_sink_logger *slog, enum xrt_input_type input_type, XrActionType result_type, const char *action_name, const char *bound_path_string, struct oxr_input_transform **out_transforms, size_t *out_transform_count) |
Create a transform array to convert input_type to result_type . More... | |
bool | oxr_input_transform_create_chain_dpad (struct oxr_logger *log, struct oxr_sink_logger *slog, enum xrt_input_type input_type, XrActionType result_type, const char *bound_path_string, struct oxr_dpad_binding_modification *dpad_binding_modification, enum oxr_dpad_region dpad_region, enum xrt_input_type activation_input_type, struct xrt_input *activation_input, struct oxr_input_transform **out_transforms, size_t *out_transform_count) |
Create a transform array to process a 2D input plus activation input to a dpad. More... | |
#include <state_trackers/oxr/oxr_input_transform.h>
Tag for the input transform.
Enumerator | |
---|---|
INPUT_TRANSFORM_INVALID | Invalid value, so that zero-initialization without further assignment is caught. |
INPUT_TRANSFORM_IDENTITY | Do not modify the input. This is only used as the root/head transform, to set the initial type. |
INPUT_TRANSFORM_VEC2_GET_X | Get the X component of a 2D float input of any range. |
INPUT_TRANSFORM_VEC2_GET_Y | Get the Y component of a 2D float input of any range. |
INPUT_TRANSFORM_THRESHOLD | Apply a threshold to any 1D float input to make a bool. This transform type has data: |
INPUT_TRANSFORM_BOOL_TO_VEC1 | Convert a bool to some range of 1D float input. This transform type has data: |
INPUT_TRANSFORM_DPAD | Interpret a 2D joystick or trackpad as a dpad. This transform type has data:
|
|
related |
Create a transform array to convert input_type
to result_type
.
[in] | log | The logger |
[in] | slog | The sink logger |
[in] | input_type | The type of input received from the hardware |
[in] | result_type | The type of input the application requested |
[in] | action_name | The action name - used for error prints only |
[in] | bound_path_string | The path name string that has been bound. |
[out] | out_transforms | A pointer that will be populated with the output array's address, or NULL. |
[out] | out_transform_count | Where to populate the array size |
References OXR_MAX_INPUT_TRANSFORMS, and oxr_slog().
|
related |
Create a transform array to process a 2D input plus activation input to a dpad.
[in] | log | The logger |
[in] | slog | The sink logger |
[in] | input_type | The type of input received from the hardware |
[in] | result_type | The type of input the application requested |
[in] | bound_path_string | The path name string that has been bound. |
[in] | dpad_settings | The dpad settings provided by the application as a binding modification. NULL means use the defaults as per the spec. |
[in] | dpad_region | The dpad region associated with this binding |
[in] | activation_input_type | The type of the activation input |
[in] | activation_input | The activation input, i.e. the input used to determine when the emulated dpad buttons should activate |
[out] | out_transforms | A pointer that will be populated with the output array's address, or NULL. |
[out] | out_transform_count | Where to populate the array size |
References OXR_MAX_INPUT_TRANSFORMS, and oxr_slog().
void oxr_input_transform_destroy | ( | struct oxr_input_transform ** | transform_ptr | ) |
Destroy an array of input transforms.
Performs null check and sets to NULL.
bool oxr_input_transform_init_bool_to_vec1 | ( | struct oxr_input_transform * | transform, |
const struct oxr_input_transform * | parent, | ||
enum xrt_input_type | result_type, | ||
float | true_val, | ||
float | false_val | ||
) |
Allocate a transform to turn a bool into an arbitrary 1D float.
Usually called automatically by oxr_input_transform_create_chain
[in,out] | transform | A pointer to the OpenXR input transformation struct to initialize. |
[in] | parent | The preceding transform |
[in] | result_type | Either XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE or XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE |
[in] | true_val | Value to return when true |
[in] | false_val | Value to return when false |
References bool_to_vec1, oxr_input_transform_bool_to_vec1_data::false_val, INPUT_TRANSFORM_BOOL_TO_VEC1, result_type, oxr_input_transform_bool_to_vec1_data::true_val, type, U_ZERO, XRT_INPUT_TYPE_BOOLEAN, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE, and XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE.
bool oxr_input_transform_init_root | ( | struct oxr_input_transform * | transform, |
enum xrt_input_type | input_type | ||
) |
Allocate an identity transform serving as the root/head of the transform chain.
Usually called automatically by oxr_input_transform_create_chain
[in,out] | transform | A pointer to the OpenXR input transformation struct to initialize. |
[in] | input_type | The native input type from the device |
References INPUT_TRANSFORM_IDENTITY, result_type, type, and U_ZERO.
bool oxr_input_transform_init_threshold | ( | struct oxr_input_transform * | transform, |
const struct oxr_input_transform * | parent, | ||
float | threshold, | ||
bool | invert | ||
) |
Allocate a transform to threshold a float to a bool.
Usually called automatically by oxr_input_transform_create_chain
[in,out] | transform | A pointer to the OpenXR input transformation struct to initialize. |
[in] | parent | The preceding transform |
[in] | threshold | Threshold value to use |
[in] | invert | If true, condition is "value <= threshold" instead of "value > threshold" |
References INPUT_TRANSFORM_THRESHOLD, oxr_input_transform_threshold_data::invert, result_type, oxr_input_transform_threshold_data::threshold, threshold, type, U_ZERO, XRT_INPUT_TYPE_BOOLEAN, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE, and XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE.
bool oxr_input_transform_init_vec2_get_x | ( | struct oxr_input_transform * | transform, |
const struct oxr_input_transform * | parent | ||
) |
Allocate a transform to get the X component of a Vec2.
Usually called automatically by oxr_input_transform_create_chain
[in,out] | transform | A pointer to the OpenXR input transformation struct to initialize. |
[in] | parent | The preceding transform |
References INPUT_TRANSFORM_VEC2_GET_X, result_type, type, U_ZERO, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE, and XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE.
bool oxr_input_transform_init_vec2_get_y | ( | struct oxr_input_transform * | transform, |
const struct oxr_input_transform * | parent | ||
) |
Allocate a transform to get the Y component of a Vec2.
Usually called automatically by oxr_input_transform_create_chain
[in,out] | transform | A pointer to the OpenXR input transformation struct to initialize. |
[in] | parent | The preceding transform |
References INPUT_TRANSFORM_VEC2_GET_Y, result_type, type, U_ZERO, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE, and XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE.
bool oxr_input_transform_process | ( | struct oxr_input_transform * | transforms, |
size_t | transform_count, | ||
const struct oxr_input_value_tagged * | input, | ||
struct oxr_input_value_tagged * | out | ||
) |
Apply an array of input transforms.
[in] | transforms | An array of input transforms |
[in] | transform_count | The number of elements in transform |
[in] | input | The input value and type |
[out] | out | The transformed value and type |