#include <OpenXRVkReferenceSpacesInterface.h>
|
using | ReferenceSpaceId = uint32_t |
|
|
static constexpr ReferenceSpaceId | ReferenceSpaceIdView = 1 |
|
static constexpr ReferenceSpaceId | ReferenceSpaceIdLocal = 2 |
|
static constexpr ReferenceSpaceId | ReferenceSpaceIdStage = 3 |
|
static constexpr char | ReferenceSpaceNameView [] = "View" |
|
static constexpr char | ReferenceSpaceNameLocal [] = "Local" |
|
static constexpr char | ReferenceSpaceNameStage [] = "Stage" |
|
static constexpr uint32_t | LeftEyeView = 0 |
| Useful constants for OpenXR Stereo systems.
|
|
static constexpr uint32_t | RightEyeView = 1 |
|
REMARK: This class must be instantiated BEFORE OpenXRActionsInterface. To know more about OpenXR Reference Spaces, see the spec: https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#spaces This interface consolidates the API that works with definition of Reference Spaces and retreival of their Poses as AZ::Transforms.
◆ AddReferenceSpace()
virtual AZ::Outcome< bool, AZStd::string > OpenXRVk::IOpenXRReferenceSpaces::AddReferenceSpace |
( |
ReferenceSpaceId |
referenceSpaceType, |
|
|
const AZStd::string & |
spaceName, |
|
|
const AZ::Transform & |
poseInReferenceSpace |
|
) |
| |
|
pure virtual |
Creates a new Reference Space, and the developer will define what name they want to use to address the new space.
- Parameters
-
referenceSpaceType | An integral, that identifies a system reference space, that will be used as anchor reference for the new space that will be created. The caller can use other integrals, different than the three constants mentioned above, but the caller would need to verify on their own that said system reference space is supported by the OpenXR Runtime they are working with. OpenXR only guarantess that View, Local and Stage are always supported. |
spaceName | Name of the new space, and must be different than any other reference space previously created. |
poseInReferenceSpace | A transform that defines the default orientation and position of the new space, relative to the system reference space defined by @referenceSpaceType. |
- Returns
- Success if the space name is unique, and the @referenceSpaceType space id is supported by the runtime. In case of failure, an error description is provided.
◆ ForceViewPosesCacheUpdate()
virtual void OpenXRVk::IOpenXRReferenceSpaces::ForceViewPosesCacheUpdate |
( |
| ) |
|
|
pure virtual |
Forces updating the cached pose and projection data for all Views (Eyes). Each frame, all view (aka eye) poses and projections are updated automatically, making this function optional to use. By default the caller simply gets the per-frame cached version, which should be fine for most applications. This API was added because according to OpenXR xrLocateViews spec: "Repeatedly calling xrLocateViews with the same time may not necessarily return the same result.
Instead the prediction gets increasingly accurate as the function is called closer to the
given time for which a prediction is made".
◆ GetBaseSpaceForViewSpacePose()
virtual const AZStd::string & OpenXRVk::IOpenXRReferenceSpaces::GetBaseSpaceForViewSpacePose |
( |
| ) |
const |
|
pure virtual |
Returns the name of the current Reference Space that is used as base reference space when locating the "View" reference space.
◆ GetReferenceSpaceNames()
virtual AZStd::vector< AZStd::string > OpenXRVk::IOpenXRReferenceSpaces::GetReferenceSpaceNames |
( |
| ) |
const |
|
pure virtual |
- Returns
- a list of strings, Where each string is the name of each active reference space. The session will always instantiate the three reference spaces mentioned above: View, Local and Stage. So this list will always contain at least three strings.
◆ GetReferenceSpaceNativeHandle()
virtual const void * OpenXRVk::IOpenXRReferenceSpaces::GetReferenceSpaceNativeHandle |
( |
const AZStd::string & |
spaceName | ) |
const |
|
pure virtual |
REMARK: Maybe it's a good idea to move this into a private interface for the OpenXRVk Gem, and privately use the native handle (XrSpace)
◆ GetReferenceSpacePose()
virtual AZ::Outcome< AZ::Transform, AZStd::string > OpenXRVk::IOpenXRReferenceSpaces::GetReferenceSpacePose |
( |
const AZStd::string & |
spaceName, |
|
|
const AZStd::string & |
baseSpaceName |
|
) |
| const |
|
pure virtual |
Returns the Pose of @spaceName relative to @baseSpaceName. This function is typically called within the game loop to poll/query the current pose of a particular reference space, relative to another reference space.
- Parameters
-
spaceName | The name of the reference space whose Transform the caller needs to know. |
baseSpaceName | The name of the base reference space that the OpenXR runtime will use to calculate a relative Transform. |
- Returns
- If successful, a Transform that defines the pose of @spaceName, relative to @baseSpaceName.
◆ GetViewCount()
virtual uint32_t OpenXRVk::IOpenXRReferenceSpaces::GetViewCount |
( |
| ) |
const |
|
pure virtual |
For an AR application running on a Phone (Mono) the count will be 1. For an AR/VR application running on a typical headset (Stereo) the count will be 2. Some headsets like the Varjo support Quad Views and the eye (view) counts will be 4.
◆ GetViewPose()
virtual const AZ::Transform & OpenXRVk::IOpenXRReferenceSpaces::GetViewPose |
( |
uint32_t |
eyeIndex | ) |
const |
|
pure virtual |
Pose of a view(aka eye) relative to the View Space (aka Head) Pose. For AR applications running on a Phone (aka Mono view configuration) the Eye View Pose is centered exactly where the View Space Centroid is located, so calling this function wouldn't make much sense because it'll return an Identity transform.
◆ GetViewPoses()
virtual const AZStd::vector< AZ::Transform > & OpenXRVk::IOpenXRReferenceSpaces::GetViewPoses |
( |
| ) |
const |
|
pure virtual |
A convenient method that returns the relative pose of all Views (aka Eyes) relative to the "View" Reference Space, which typically represents the user's head centroid.
◆ GetViewSpacePose()
virtual const AZ::Transform & OpenXRVk::IOpenXRReferenceSpaces::GetViewSpacePose |
( |
| ) |
const |
|
pure virtual |
- Returns
- The per-frame "calculated and cached" Pose of the "View" Reference Space.
◆ RemoveReferenceSpace()
virtual AZ::Outcome< bool, AZStd::string > OpenXRVk::IOpenXRReferenceSpaces::RemoveReferenceSpace |
( |
const AZStd::string & |
spaceName | ) |
|
|
pure virtual |
Removes a previously user-created reference space.
- Parameters
-
spaceName | The name of the reference space to remove. |
- Returns
- Success if a reference space with said name exists and it is NOT one of "View", "Local" or "Stage".
◆ SetBaseSpaceForViewSpacePose()
virtual AZ::Outcome< bool, AZStd::string > OpenXRVk::IOpenXRReferenceSpaces::SetBaseSpaceForViewSpacePose |
( |
const AZStd::string & |
spaceName | ) |
|
|
pure virtual |
With this method the caller defines the base reference space that will be used each frame to locate the "View" reference space. Each frame, The "View" reference space is the only reference space that will be automatically located, and its pose will be internally cached. The located pose will always be relative to the @spaceName defined the last time this method was called. If this method is never called, the runtime will default to the "Local" reference spaces as the base reference space that will be used to locate the "View" reference space. This is a stateful API, you only need to call this method once, or as needed. Each time GetViewSpacePose() is called, the returned Transform will be relative to @spaceName
- Parameters
-
spaceName | The name of the base reference space that will be used to caculate the pose of the View space. |
The documentation for this class was generated from the following file:
- Gems/OpenXRVk/Code/Include/OpenXRVk/OpenXRVkReferenceSpacesInterface.h