|
VTK
9.6.20260428
|
Singleton class that holds a collection of utility functions and member variables to communicate with the OpenXR runtime. More...
#include <vtkOpenXRManager.h>
Classes | |
| struct | Action_t |
| struct | RenderResources_t |
| This struct stores all needed information to render the images and send it to the user We can't make a vector of struct because OpenXR SDK needs an array of XrXXX for xrEnumerate functions. More... | |
| struct | Swapchain_t |
| Swapchain structure storing information common to all rendering backend. More... | |
Public Types | |
| enum | OutputLevel { DebugOutput = 0 , WarningOutput = 1 , ErrorOutput = 2 } |
| enum | ControllerIndex { Inactive = -1 , Left = 0 , Right = 1 , Head = 2 , Generic = 3 , NumberOfControllers = 4 } |
Public Member Functions | |
| uint32_t | GetViewCount () |
| Return the number of OpenXR views (typically one per physical display / eye) | |
| bool | IsSceneUnderstandingSupported () |
| Return true if the runtime supports the scene understanding extension. | |
| const std::array< XrPath, 2 > & | GetSubactionPaths () |
| void | DestroyActionSets () |
| Iterate over and destroy all action sets that have been created. | |
| bool | ApplyVibration (const Action_t &actionT, int hand, float amplitude=0.5, float duration=25000000.0, float frequency=XR_FREQUENCY_UNSPECIFIED) |
Apply haptic vibration action to emit vibration on hand to emit on amplitude 0.0 to 1.0. | |
| XrSystemId | GetSystemID () const |
| Return OpenXR System ID associated with the XrSession. | |
| XrSpace | GetReferenceSpace () const |
| Return XrSpace associated with the XrSession. | |
| XrTime | GetPredictedDisplayTime () const |
| Return runtime predicted display time for next frame. | |
| bool | XrCheckOutput (OutputLevel level, const XrResult &, const std::string &message) |
| Utility function to check the XrResult, print the result message as a debug, warning or error message if the result failed. | |
| void | PrintInstanceProperties () |
| Utility functions to print information about OpenXR manager internal structures. | |
| void | PrintSystemProperties (XrSystemProperties *system_properties) |
| Utility functions to print information about OpenXR manager internal structures. | |
| void | PrintSupportedViewConfigs () |
| Utility functions to print information about OpenXR manager internal structures. | |
| void | PrintViewConfigViewInfo (const std::vector< XrViewConfigurationView > &) |
| Utility functions to print information about OpenXR manager internal structures. | |
| bool | PrintReferenceSpaces () |
| Utility functions to print information about OpenXR manager internal structures. | |
| bool | Initialize (vtkOpenXRRenderWindow *xrWindow) |
| Internal API. | |
| void | Finalize () |
| Internal API. | |
| std::tuple< uint32_t, uint32_t > | GetRecommendedImageRectSize () |
| Return as a tuple the OpenXR recommended texture size to be sent to the device. | |
| uint32_t | GetRecommendedSampleCount () |
| Return the recommended swapchain sample count. | |
| std::string | GetOpenXRPropertiesAsString () |
| Return the OpenXR properties as a string, with format "RuntimeName MAJOR.MINOR.PATCH". | |
| const XrPosef * | GetViewPose (uint32_t eye) |
| Returns a pointer to the view pose that contains the view orientation and position for the specified eye, or nullptr if eye exceeds or equals the number of configured views. | |
| const XrFovf * | GetProjectionFov (uint32_t eye) |
| Returns a pointer to the projection field of view for the specified eye, or nullptr if eye exceeds or equals the number of configured views. | |
| bool | IsDepthExtensionSupported () |
| Return true if the runtime supports the depth extension. | |
| bool | GetShouldRenderCurrentFrame () |
| Return true if the current frame should be rendered. | |
| bool | BeginSession () |
| Start the OpenXR session. | |
| const XrSession & | GetSession () |
| Return the OpenXR Session. | |
| const XrInstance & | GetXrRuntimeInstance () |
| Return the instance used to communicate with the runtime. | |
| bool | IsSessionRunning () |
| Return true if the OpenXR session is currently running, ie. | |
| bool | WaitAndBeginFrame () |
| This function is used to start a frame. | |
| bool | PrepareRendering (vtkOpenXRRenderWindow *win, void *colorTextureId, void *depthTextureId) |
Prepare the rendering resources for the specified eye and store in colorTextureId and in depthTextureId (if the depth extension is supported) the texture in which we need to draw pixels. | |
| void | ReleaseSwapchainImage (uint32_t eye) |
| When the rendering in a swapchain image is done, it must be released with this function. | |
| bool | EndFrame () |
| Submit the composition layers for the predicted display time of the current frame. | |
| bool | PollEvent (XrEventDataBuffer &eventData) |
| Store in eventData the result of xrPollEvent. | |
| XrPath | GetXrPath (const std::string &path) |
Get the XrPath from the well-formed string path. | |
| bool | CreateActionSet (const std::string &actionSetName, const std::string &localizedActionSetName) |
| Creates an action set and add it to the vector of action sets. | |
| bool | SelectActiveActionSet (unsigned int index) |
| Selects the current active action set from the ActionSets vector using its index. | |
| bool | AttachSessionActionSets () |
| Attach all action sets in the ActionSets vector to the session. | |
| bool | CreateOneAction (Action_t &actionT, const std::string &name, const std::string &localizedName) |
Creates one action with name name and localizedName localizedName and store the action handle inside actionT using the selected active action set. | |
| bool | SuggestActions (const std::string &profile, std::vector< XrActionSuggestedBinding > &actionSuggestedBindings) |
Suggest actions stored in actionSuggestedBindings for the interaction profile profile. | |
| bool | SyncActions () |
| Update the action states using the active action set. | |
| bool | UpdateActionData (Action_t &action_t, int hand) |
| Update the action data and store it in action_t.States for one hand. | |
| void | SetGraphicsStrategy (vtkOpenXRManagerGraphics *gs) |
| Set/Get the rendering backend strategy. | |
| vtkOpenXRManagerGraphics * | GetGraphicsStrategy () |
| Set/Get the rendering backend strategy. | |
| void | SetConnectionStrategy (vtkOpenXRManagerConnection *cs) |
| Set/Get the connection strategy. | |
| vtkOpenXRManagerConnection * | GetConnectionStrategy () |
| Set/Get the connection strategy. | |
Static Public Member Functions | |
| static vtkOpenXRManager & | GetInstance () |
| Return the singleton instance. | |
Protected Member Functions | |
| vtkOpenXRManager () | |
| ~vtkOpenXRManager ()=default | |
| bool | LoadControllerModels () |
| bool | CreateInstance (vtkOpenXRRenderWindow *window) |
| OpenXR Instance creation. | |
| std::vector< const char * > | SelectExtensions (vtkOpenXRRenderWindow *window) |
| OpenXR Instance creation. | |
| void | PrintOptionalExtensions () |
| Print the optional extensions which were found and enabled. | |
| bool | CreateSystem () |
| OpenXR System creation. | |
| bool | CreateSystemProperties () |
| Enable system properties such as hand tracking, and choose environment blend modes. | |
| bool | CreateSession () |
| Create the session and pass the GraphicsBinding to the next pointer of the XrSessionCreateInfo. | |
| bool | CreateSwapchains () |
| Swapchaines creation : there is one swapchain per view / display. | |
| bool | CreateConfigViews () |
| There is one configuration view per view, and it contains the recommended texture resolution in pixels and the recommended swapchain samples. | |
| std::tuple< int64_t, int64_t > | SelectSwapchainPixelFormats () |
| During the creation of the swapchains, we need to check the runtime available pixels formats, and we pick the first one from the list of our supported color and depth formats returned by vtkOpenXRManagerGraphics::GetSupportedColorFormats and vtkOpenXRManagerGraphics::GetSupportedDepthFormats. | |
| Swapchain_t | CreateSwapchain (int64_t format, uint32_t width, uint32_t height, uint32_t sampleCount, XrSwapchainCreateFlags createFlags, XrSwapchainUsageFlags usageFlags) |
| Create an XrSwapchain handle used to present rendered image to the user with the given parameters for the XrSwapchainCreateInfo structure. | |
| bool | CreateReferenceSpace () |
| Creates the reference space of type ReferenceSpaceType that will be used to locate views. | |
| bool | CreateOneActionSpace (const XrAction &action, const XrPath &subactionPath, const XrPosef &poseInActionSpace, XrSpace &space) |
| For pose actions, we must create an action space to locate it. | |
| bool | CreateSubactionPaths () |
| Creates one subaction path for each hand. | |
| uint32_t | WaitAndAcquireSwapchainImage (const XrSwapchain &swapchainHandle) |
| When preparing the rendering for an eye, we must ask the runtime for a texture to draw in it. | |
Protected Attributes | ||
| XrReferenceSpaceType | ReferenceSpaceType = XR_REFERENCE_SPACE_TYPE_STAGE | |
| XrInstance | Instance | |
| XrSystemId | SystemId | |
| XrSession | Session | |
| XrSessionState | SessionState | |
| XrSpace | ReferenceSpace | |
| XrEnvironmentBlendMode | EnvironmentBlendMode | |
| bool | RenderingBackendExtensionSupported = false | |
| std::array< XrPath, 2 > | SubactionPaths | |
| std::vector< XrActionSet > | ActionSets | |
| XrActionSet * | ActiveActionSet = nullptr | |
| XrTime | PredictedDisplayTime | |
| Store the frame predicted display time in WaitAndBeginFrame To get the action data at this time and to submit it in EndFrame. | ||
| bool | SessionRunning = false | |
| bool | ShouldRenderCurrentFrame = false | |
| bool | StorePoseVelocities = false | |
| vtkSmartPointer< vtkOpenXRManagerGraphics > | GraphicsStrategy | |
| vtkSmartPointer< vtkOpenXRManagerConnection > | ConnectionStrategy | |
| struct { | ||
| bool DepthExtensionSupported { false } | ||
| bool ControllerModelExtensionSupported { false } | ||
| bool UnboundedRefSpaceSupported { false } | ||
| bool SpatialAnchorSupported { false } | ||
| bool HandInteractionSupported { false } | ||
| bool HandTrackingSupported { false } | ||
| bool RemotingSupported { false } | ||
| bool SceneUnderstandingSupported { false } | ||
| bool SceneMarkerSupported { false } | ||
| } | OptionalExtensions | |
| Structure to hold optional extensions loaded with SelectExtensions. | ||
| std::unique_ptr< RenderResources_t > | RenderResources | |
Static Protected Attributes | |
| static constexpr XrFormFactor | FormFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY |
| static constexpr XrViewConfigurationType | ViewType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO |
| static constexpr uint32_t | StereoViewCount = 2 |
Singleton class that holds a collection of utility functions and member variables to communicate with the OpenXR runtime.
vtkOpenXRManager is not a vtkObject, the singleton unique instance gets allocated on the stack the first time vtkOpenXRManager::GetInstance() is called.
Definition at line 42 of file vtkOpenXRManager.h.
| Enumerator | |
|---|---|
| DebugOutput | |
| WarningOutput | |
| ErrorOutput | |
Definition at line 56 of file vtkOpenXRManager.h.
| Enumerator | |
|---|---|
| Inactive | |
| Left | |
| Right | |
| Head | |
| Generic | |
| NumberOfControllers | |
Definition at line 350 of file vtkOpenXRManager.h.
|
protected |
|
protecteddefault |
|
inlinestatic |
Return the singleton instance.
Definition at line 49 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::XrCheckOutput | ( | OutputLevel | level, |
| const XrResult & | , | ||
| const std::string & | message ) |
Utility function to check the XrResult, print the result message as a debug, warning or error message if the result failed.
| void vtk::detail::vtkOpenXRManager::PrintInstanceProperties | ( | ) |
Utility functions to print information about OpenXR manager internal structures.
| void vtk::detail::vtkOpenXRManager::PrintSystemProperties | ( | XrSystemProperties * | system_properties | ) |
Utility functions to print information about OpenXR manager internal structures.
| void vtk::detail::vtkOpenXRManager::PrintSupportedViewConfigs | ( | ) |
Utility functions to print information about OpenXR manager internal structures.
| void vtk::detail::vtkOpenXRManager::PrintViewConfigViewInfo | ( | const std::vector< XrViewConfigurationView > & | ) |
Utility functions to print information about OpenXR manager internal structures.
| bool vtk::detail::vtkOpenXRManager::PrintReferenceSpaces | ( | ) |
Utility functions to print information about OpenXR manager internal structures.
| bool vtk::detail::vtkOpenXRManager::Initialize | ( | vtkOpenXRRenderWindow * | xrWindow | ) |
Internal API.
Managed by vtkOpenXRRenderWindow.
Initialize the OpenXR SDK to render images in a virtual reality device. The HelperWindow of xrWindow must be a vtkWin32OpenGLRenderWindow if the platform is Win32, else a vtkXOpenGLRenderWindow if the platform is X.
| void vtk::detail::vtkOpenXRManager::Finalize | ( | ) |
Internal API.
Managed by vtkOpenXRRenderWindow.
End the OpenXR session and destroy it and the OpenXR instance.
| std::tuple< uint32_t, uint32_t > vtk::detail::vtkOpenXRManager::GetRecommendedImageRectSize | ( | ) |
Return as a tuple the OpenXR recommended texture size to be sent to the device.
| uint32_t vtk::detail::vtkOpenXRManager::GetRecommendedSampleCount | ( | ) |
Return the recommended swapchain sample count.
|
inline |
Return the number of OpenXR views (typically one per physical display / eye)
Definition at line 119 of file vtkOpenXRManager.h.
| std::string vtk::detail::vtkOpenXRManager::GetOpenXRPropertiesAsString | ( | ) |
Return the OpenXR properties as a string, with format "RuntimeName MAJOR.MINOR.PATCH".
|
inline |
Returns a pointer to the view pose that contains the view orientation and position for the specified eye, or nullptr if eye exceeds or equals the number of configured views.
This class retains responsibility for the memory pointed to by the return value.
Definition at line 139 of file vtkOpenXRManager.h.
|
inline |
Returns a pointer to the projection field of view for the specified eye, or nullptr if eye exceeds or equals the number of configured views.
This class retains responsibility for the memory pointed to by the return value.
Definition at line 155 of file vtkOpenXRManager.h.
|
inline |
Return true if the runtime supports the depth extension.
This value is defined by vtkOpenXRManager::Initialize.
Definition at line 171 of file vtkOpenXRManager.h.
|
inline |
Return true if the runtime supports the scene understanding extension.
This value is defined by vtkOpenXRManager::Initialize.
Definition at line 179 of file vtkOpenXRManager.h.
|
inline |
Return true if the current frame should be rendered.
This value is updated each time we call WaitAndBeginFrame and EndFrame.
Definition at line 190 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::BeginSession | ( | ) |
Start the OpenXR session.
If successful, SessionRunning becomes true.
|
inline |
Return the OpenXR Session.
Definition at line 205 of file vtkOpenXRManager.h.
|
inline |
Return the instance used to communicate with the runtime.
Definition at line 212 of file vtkOpenXRManager.h.
|
inline |
Return true if the OpenXR session is currently running, ie.
the call to BeginSession was successful.
Definition at line 220 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::WaitAndBeginFrame | ( | ) |
This function is used to start a frame.
If the frame should be rendered, then we locate the views to update the view pose and projection for each eye / display
| bool vtk::detail::vtkOpenXRManager::PrepareRendering | ( | vtkOpenXRRenderWindow * | win, |
| void * | colorTextureId, | ||
| void * | depthTextureId ) |
Prepare the rendering resources for the specified eye and store in colorTextureId and in depthTextureId (if the depth extension is supported) the texture in which we need to draw pixels.
win is used to get the right clipping planes for the depth extension. Return true if no error occurred.
| void vtk::detail::vtkOpenXRManager::ReleaseSwapchainImage | ( | uint32_t | eye | ) |
When the rendering in a swapchain image is done, it must be released with this function.
| bool vtk::detail::vtkOpenXRManager::EndFrame | ( | ) |
Submit the composition layers for the predicted display time of the current frame.
It must be called at the end of each frame.
| bool vtk::detail::vtkOpenXRManager::PollEvent | ( | XrEventDataBuffer & | eventData | ) |
Store in eventData the result of xrPollEvent.
| XrPath vtk::detail::vtkOpenXRManager::GetXrPath | ( | const std::string & | path | ) |
Get the XrPath from the well-formed string path.
|
inline |
Definition at line 272 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::CreateActionSet | ( | const std::string & | actionSetName, |
| const std::string & | localizedActionSetName ) |
Creates an action set and add it to the vector of action sets.
| bool vtk::detail::vtkOpenXRManager::SelectActiveActionSet | ( | unsigned int | index | ) |
Selects the current active action set from the ActionSets vector using its index.
| bool vtk::detail::vtkOpenXRManager::AttachSessionActionSets | ( | ) |
Attach all action sets in the ActionSets vector to the session.
| void vtk::detail::vtkOpenXRManager::DestroyActionSets | ( | ) |
Iterate over and destroy all action sets that have been created.
| bool vtk::detail::vtkOpenXRManager::CreateOneAction | ( | Action_t & | actionT, |
| const std::string & | name, | ||
| const std::string & | localizedName ) |
Creates one action with name name and localizedName localizedName and store the action handle inside actionT using the selected active action set.
| bool vtk::detail::vtkOpenXRManager::SuggestActions | ( | const std::string & | profile, |
| std::vector< XrActionSuggestedBinding > & | actionSuggestedBindings ) |
Suggest actions stored in actionSuggestedBindings for the interaction profile profile.
| bool vtk::detail::vtkOpenXRManager::SyncActions | ( | ) |
Update the action states using the active action set.
This function should be called before UpdateActionData
| bool vtk::detail::vtkOpenXRManager::UpdateActionData | ( | Action_t & | action_t, |
| int | hand ) |
Update the action data and store it in action_t.States for one hand.
For pose actions :
| bool vtk::detail::vtkOpenXRManager::ApplyVibration | ( | const Action_t & | actionT, |
| int | hand, | ||
| float | amplitude = 0.5, | ||
| float | duration = 25000000.0, | ||
| float | frequency = XR_FREQUENCY_UNSPECIFIED ) |
Apply haptic vibration action to emit vibration on hand to emit on amplitude 0.0 to 1.0.
duration nanoseconds, default 25ms frequency (hz)
|
inline |
Set/Get the rendering backend strategy.
Definition at line 382 of file vtkOpenXRManager.h.
|
inline |
Set/Get the rendering backend strategy.
Definition at line 383 of file vtkOpenXRManager.h.
|
inline |
Set/Get the connection strategy.
Definition at line 390 of file vtkOpenXRManager.h.
|
inline |
Set/Get the connection strategy.
Definition at line 391 of file vtkOpenXRManager.h.
|
inline |
Return OpenXR System ID associated with the XrSession.
Definition at line 397 of file vtkOpenXRManager.h.
|
inline |
Return XrSpace associated with the XrSession.
Definition at line 402 of file vtkOpenXRManager.h.
|
inline |
Return runtime predicted display time for next frame.
This may be needed for some OpenXR API calls that requires time information. This is updated by WaitAndBeginFrame()
Definition at line 409 of file vtkOpenXRManager.h.
|
protected |
OpenXR Instance creation.
This is where we select the extensions using SelectExtensions
|
protected |
OpenXR Instance creation.
This is where we select the extensions using SelectExtensions
|
protected |
Print the optional extensions which were found and enabled.
|
protected |
OpenXR System creation.
|
protected |
Enable system properties such as hand tracking, and choose environment blend modes.
|
protected |
Create the session and pass the GraphicsBinding to the next pointer of the XrSessionCreateInfo.
|
protected |
Swapchaines creation : there is one swapchain per view / display.
This function calls CreateConfigViews
|
protected |
There is one configuration view per view, and it contains the recommended texture resolution in pixels and the recommended swapchain samples.
|
protected |
During the creation of the swapchains, we need to check the runtime available pixels formats, and we pick the first one from the list of our supported color and depth formats returned by vtkOpenXRManagerGraphics::GetSupportedColorFormats and vtkOpenXRManagerGraphics::GetSupportedDepthFormats.
|
protected |
Create an XrSwapchain handle used to present rendered image to the user with the given parameters for the XrSwapchainCreateInfo structure.
|
protected |
Creates the reference space of type ReferenceSpaceType that will be used to locate views.
|
protected |
|
protected |
For pose actions, we must create an action space to locate it.
|
protected |
Creates one subaction path for each hand.
|
protected |
When preparing the rendering for an eye, we must ask the runtime for a texture to draw in it.
|
staticconstexprprotected |
Definition at line 526 of file vtkOpenXRManager.h.
|
staticconstexprprotected |
Definition at line 529 of file vtkOpenXRManager.h.
|
staticconstexprprotected |
Definition at line 532 of file vtkOpenXRManager.h.
|
protected |
Definition at line 537 of file vtkOpenXRManager.h.
|
protected |
Definition at line 540 of file vtkOpenXRManager.h.
|
protected |
Definition at line 543 of file vtkOpenXRManager.h.
|
protected |
Definition at line 545 of file vtkOpenXRManager.h.
|
protected |
Definition at line 546 of file vtkOpenXRManager.h.
|
protected |
Definition at line 547 of file vtkOpenXRManager.h.
|
protected |
Definition at line 554 of file vtkOpenXRManager.h.
|
protected |
Definition at line 557 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::DepthExtensionSupported { false } |
Definition at line 566 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::ControllerModelExtensionSupported { false } |
Definition at line 567 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::UnboundedRefSpaceSupported { false } |
Definition at line 568 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::SpatialAnchorSupported { false } |
Definition at line 569 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::HandInteractionSupported { false } |
Definition at line 570 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::HandTrackingSupported { false } |
Definition at line 571 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::RemotingSupported { false } |
Definition at line 572 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::SceneUnderstandingSupported { false } |
Definition at line 573 of file vtkOpenXRManager.h.
| bool vtk::detail::vtkOpenXRManager::SceneMarkerSupported { false } |
Definition at line 574 of file vtkOpenXRManager.h.
| struct { ... } vtk::detail::vtkOpenXRManager::OptionalExtensions |
Structure to hold optional extensions loaded with SelectExtensions.
|
protected |
Definition at line 611 of file vtkOpenXRManager.h.
|
protected |
Definition at line 615 of file vtkOpenXRManager.h.
|
protected |
Definition at line 617 of file vtkOpenXRManager.h.
|
protected |
Definition at line 618 of file vtkOpenXRManager.h.
|
protected |
Store the frame predicted display time in WaitAndBeginFrame To get the action data at this time and to submit it in EndFrame.
Definition at line 624 of file vtkOpenXRManager.h.
|
protected |
Definition at line 626 of file vtkOpenXRManager.h.
|
protected |
Definition at line 632 of file vtkOpenXRManager.h.
|
protected |
Definition at line 635 of file vtkOpenXRManager.h.
|
protected |
Definition at line 637 of file vtkOpenXRManager.h.
|
protected |
Definition at line 639 of file vtkOpenXRManager.h.