Ocean
|
This class implements a wrapper for an OpenXR action set. More...
#include <ActionSet.h>
Public Types | |
typedef uint32_t | ActionId |
Definition of an id for an action. | |
typedef std::unordered_map< ActionId, XrAction > | ActionIdMap |
Definition of an unordered map mapping action ids to XrAction objects. | |
typedef std::vector< std::string > | Paths |
Definition of a vector holding strings. | |
Public Member Functions | |
ActionSet () noexcept=default | |
Default constructor. | |
ActionSet (ActionSet &&actionSet) noexcept | |
Move constructor. | |
~ActionSet () | |
Destructs this action set and releases all resources. | |
bool | initialize (const XrInstance &xrInstance, const std::string &name, const std::string &description, const uint32_t priority=0u) |
Initializes the action set. | |
ActionId | createAction (const XrActionType xrActionType, const std::string &name, const std::string &description, const ActionId actionId=invalidActionId_) |
Creates a new action. | |
ActionId | createAction (const XrActionType xrActionType, const std::string &name, const std::string &description, const Paths &subactionPaths, const ActionId actionId=invalidActionId_) |
Creates a new action. | |
ActionId | createAction (const XrActionType xrActionType, const std::string &name, const std::string &description, const XrPaths &xrSubactionPaths, const ActionId actionId=invalidActionId_) |
Creates a new action. | |
ActionId | createActionWithBinding (const XrActionType xrActionType, const std::string &name, const std::string &description, const std::string &path, const ActionId actionId=invalidActionId_) |
Creates a new action and directly adds an action binding. | |
bool | addActionBinding (const ActionId actionId, const std::string &path) |
Adds an action binding. | |
bool | addActionBinding (const ActionId actionId, const XrPath &xrPath) |
Adds an action binding. | |
bool | suggestActionBindings (const XrInstance &xrInstance, const std::string &interactionProfile) |
Suggests the actions of this set as binding. | |
bool | suggestActionBindings (const XrInstance &xrInstance, const XrPath &xrInteractionProfilePath) |
Suggests the actions of this set as binding. | |
XrAction | action (const ActionId actionId) const |
Returns an action of this set. | |
template<typename T > | |
bool | actionState (const XrSession &xrSession, const ActionId actionId, T &state) const |
Determines the state of an action. | |
void | release () |
Explicitly releases the action set and all associated actions and resources. | |
bool | actionBindingsSuggested () const |
Returns true whether the actions have been set as applicated-suggested bindings. | |
bool | isValid () const |
Returns whether this object holds a valid OpenXR action set. | |
operator XrActionSet () const | |
Returns the wrapped OpenXR action set. | |
operator bool () const | |
Returns whether this object holds a valid OpenXR action set. | |
ActionSet & | operator= (ActionSet &&actionSet) noexcept |
Move operator. | |
template<> | |
bool | actionState (const XrSession &xrSession, const XrAction &xrAction, XrActionStateBoolean &state) |
template<> | |
bool | actionState (const XrSession &xrSession, const XrAction &xrAction, XrActionStateFloat &state) |
template<> | |
bool | actionState (const XrSession &xrSession, const XrAction &xrAction, XrActionStateVector2f &state) |
template<> | |
bool | actionState (const XrSession &xrSession, const XrAction &xrAction, XrActionStatePose &state) |
Static Public Member Functions | |
template<typename T > | |
static bool | actionState (const XrSession &xrSession, const XrAction &xrAction, T &state) |
Determines the state of an action. | |
Static Public Attributes | |
static constexpr ActionId | invalidActionId_ = ActionId(-1) |
An invalid action id. | |
Protected Types | |
typedef std::vector< XrActionSuggestedBinding > | XrActionSuggestedBindings |
Definition of a vector holding XrActionSuggestedBinding objects. | |
Protected Member Functions | |
ActionSet (const ActionSet &)=delete | |
Disabled copy constructor. | |
ActionSet & | operator= (const ActionSet &)=delete |
Disabled assign operator. | |
Protected Attributes | |
XrInstance | xrInstance_ = XR_NULL_HANDLE |
The OpenXR instance associated with this action set. | |
XrActionSet | xrActionSet_ = XR_NULL_HANDLE |
The action OpenXR action set. | |
ActionIdMap | actionIdMap_ |
The actions of this action set. | |
ActionId | actionIdCounter_ = 0u |
The counter of unique action ids. | |
XrActionSuggestedBindings | xrActionSuggestedBindings_ |
The XrActionSuggestedBindings of this action set. | |
bool | actionBindingsSuggested_ = false |
True, if the actions have been set as applicated-suggested bindings. | |
Lock | lock_ |
The action set's lock. | |
This class implements a wrapper for an OpenXR action set.
typedef uint32_t Ocean::Platform::OpenXR::ActionSet::ActionId |
Definition of an id for an action.
typedef std::unordered_map<ActionId, XrAction> Ocean::Platform::OpenXR::ActionSet::ActionIdMap |
Definition of an unordered map mapping action ids to XrAction objects.
typedef std::vector<std::string> Ocean::Platform::OpenXR::ActionSet::Paths |
Definition of a vector holding strings.
|
protected |
Definition of a vector holding XrActionSuggestedBinding objects.
|
defaultnoexcept |
Default constructor.
|
inlinenoexcept |
Move constructor.
actionSet | The action set to be moved |
Ocean::Platform::OpenXR::ActionSet::~ActionSet | ( | ) |
Destructs this action set and releases all resources.
|
protecteddelete |
Disabled copy constructor.
XrAction Ocean::Platform::OpenXR::ActionSet::action | ( | const ActionId | actionId | ) | const |
Returns an action of this set.
actionId | The id of the action, must be valid |
bool Ocean::Platform::OpenXR::ActionSet::actionBindingsSuggested | ( | ) | const |
Returns true whether the actions have been set as applicated-suggested bindings.
bool Ocean::Platform::OpenXR::ActionSet::actionState | ( | const XrSession & | xrSession, |
const ActionId | actionId, | ||
T & | state | ||
) | const |
Determines the state of an action.
xrSession | The session to which the action belongs (is synchronized), must be valid |
actionId | The id of the action, must be valid |
state | The resulting state |
T | The data type of the state, either 'XrActionStateBoolean', 'xrGetActionStateFloat', 'XrActionStateVector2f', or 'xrGetActionStatePose' |
|
static |
Determines the state of an action.
xrSession | The session to which the action belongs (is synchronized), must be valid |
xrAction | The action for which the state will be returned, must be valid |
state | The resulting state |
T | The data type of the state, either 'XrActionStateBoolean', 'xrGetActionStateFloat', 'XrActionStateVector2f', or 'xrGetActionStatePose' |
|
inline |
|
inline |
|
inline |
|
inline |
bool Ocean::Platform::OpenXR::ActionSet::addActionBinding | ( | const ActionId | actionId, |
const std::string & | path | ||
) |
Adds an action binding.
actionId | The id of the action to bind, must be valid |
path | The OpenXR path to which the action will be bound, must be valid |
bool Ocean::Platform::OpenXR::ActionSet::addActionBinding | ( | const ActionId | actionId, |
const XrPath & | xrPath | ||
) |
Adds an action binding.
actionId | The id of the action to bind, must be valid |
xrPath | The OpenXR path to which the action will be bound, must be valid |
ActionId Ocean::Platform::OpenXR::ActionSet::createAction | ( | const XrActionType | xrActionType, |
const std::string & | name, | ||
const std::string & | description, | ||
const ActionId | actionId = invalidActionId_ |
||
) |
Creates a new action.
In case an external managed id is provided, the id must be unique and must not be associated with an existing id already.
xrActionType | The type of the action to be created, must be valid |
name | The name of the action, must be valid |
description | The description of the action, must be valid |
actionId | The id of the action, an explicit (externally managed id), or invalidActionId_ to use an internally managed id |
ActionId Ocean::Platform::OpenXR::ActionSet::createAction | ( | const XrActionType | xrActionType, |
const std::string & | name, | ||
const std::string & | description, | ||
const Paths & | subactionPaths, | ||
const ActionId | actionId = invalidActionId_ |
||
) |
Creates a new action.
In case an external managed id is provided, the id must be unique and must not be associated with an existing id already.
xrActionType | The type of the action to be created, must be valid |
name | The name of the action, must be valid |
description | The description of the action, must be valid |
subactionPaths | Optional sub-action paths |
actionId | The id of the action, an explicit (externally managed id), or invalidActionId_ to use an internally managed id |
ActionId Ocean::Platform::OpenXR::ActionSet::createAction | ( | const XrActionType | xrActionType, |
const std::string & | name, | ||
const std::string & | description, | ||
const XrPaths & | xrSubactionPaths, | ||
const ActionId | actionId = invalidActionId_ |
||
) |
Creates a new action.
In case an external managed id is provided, the id must be unique and must not be associated with an existing id already.
xrActionType | The type of the action to be created, must be valid |
name | The name of the action, must be valid |
description | The description of the action, must be valid |
xrSubactionPaths | Optional sub-action paths |
actionId | The id of the action, an explicit (externally managed id), or invalidActionId_ to use an internally managed id |
|
inline |
Creates a new action and directly adds an action binding.
In case an external managed id is provided, the id must be unique and must not be associated with an existing id already.
xrActionType | The type of the action to be created, must be valid |
name | The name of the action, must be valid |
description | The description of the action, must be valid |
path | The OpenXR path to which the action will be bound, must be valid |
actionId | The id of the action, an explicit (externally managed id), or invalidActionId_ to use an internally managed id |
bool Ocean::Platform::OpenXR::ActionSet::initialize | ( | const XrInstance & | xrInstance, |
const std::string & | name, | ||
const std::string & | description, | ||
const uint32_t | priority = 0u |
||
) |
Initializes the action set.
xrInstance | The OpenXR instance for which the action set will be created, must be valid |
name | The action set's name, must be valid |
description | The action set's description, must be valid |
priority | The action set's priority, with range [0, infinity) |
bool Ocean::Platform::OpenXR::ActionSet::isValid | ( | ) | const |
Returns whether this object holds a valid OpenXR action set.
|
inlineexplicit |
|
inline |
Move operator.
actionSet | The action set object to be moved |
Disabled assign operator.
void Ocean::Platform::OpenXR::ActionSet::release | ( | ) |
Explicitly releases the action set and all associated actions and resources.
|
inline |
Suggests the actions of this set as binding.
xrInstance | The OpenXR instance for which the action set will be created, must be valid |
interactionProfile | The interaction profile to be used, must be valid |
bool Ocean::Platform::OpenXR::ActionSet::suggestActionBindings | ( | const XrInstance & | xrInstance, |
const XrPath & | xrInteractionProfilePath | ||
) |
Suggests the actions of this set as binding.
xrInstance | The OpenXR instance for which the action set will be created, must be valid |
xrInteractionProfilePath | The interaction profile to be used, must be valid |
|
protected |
True, if the actions have been set as applicated-suggested bindings.
|
protected |
The counter of unique action ids.
|
protected |
The actions of this action set.
|
staticconstexpr |
An invalid action id.
|
mutableprotected |
The action set's lock.
|
protected |
The action OpenXR action set.
|
protected |
The XrActionSuggestedBindings of this action set.
|
protected |
The OpenXR instance associated with this action set.