15 #ifndef vtkOpenXRManager_h
16 #define vtkOpenXRManager_h
18 #include "vtkABINamespace.h"
19 #include "vtkRenderingOpenXRModule.h"
34 VTK_ABI_NAMESPACE_BEGIN
41 VTK_ABI_NAMESPACE_BEGIN
52 return UniqueInstance;
68 bool XrCheckOutput(OutputLevel
level,
const XrResult&,
const std::string& message);
75 void PrintInstanceProperties();
76 void PrintSystemProperties(XrSystemProperties* system_properties);
77 void PrintSupportedViewConfigs();
78 void PrintViewConfigViewInfo(
const std::vector<XrViewConfigurationView>&);
79 bool PrintReferenceSpaces();
106 std::tuple<uint32_t, uint32_t> GetRecommendedImageRectSize();
113 uint32_t GetRecommendedSampleCount();
121 return static_cast<uint32_t
>(this->RenderResources->ConfigViews.size());
141 if (eye >= this->GetViewCount())
145 return &(this->RenderResources->Views[eye].pose);
157 if (eye >= this->GetViewCount())
161 return &(this->RenderResources->Views[eye].fov);
181 return this->OptionalExtensions.SceneUnderstandingSupported;
229 bool WaitAndBeginFrame();
247 void ReleaseSwapchainImage(uint32_t eye);
262 bool PollEvent(XrEventDataBuffer& eventData);
286 bool SelectActiveActionSet(
unsigned int index);
293 bool AttachSessionActionSets();
300 void DestroyActionSets();
311 bool CreateOneAction(
320 const std::string&
profile, std::vector<XrActionSuggestedBinding>& actionSuggestedBindings);
339 bool UpdateActionData(Action_t& action_t,
int hand);
347 bool ApplyVibration(
const Action_t& actionT,
int hand,
float amplitude = 0.5,
348 float duration = 25000000.0,
float frequency = XR_FREQUENCY_UNSPECIFIED);
357 NumberOfControllers = 4
371 } States[ControllerIndex::NumberOfControllers];
373 XrSpace PoseSpaces[ControllerIndex::NumberOfControllers];
374 XrSpaceLocation PoseLocations[ControllerIndex::NumberOfControllers];
375 XrSpaceVelocity PoseVelocities[ControllerIndex::NumberOfControllers];
429 void PrintOptionalExtensions();
444 bool CreateSystemProperties();
453 bool CreateSession();
461 bool CreateSwapchains();
469 bool CreateConfigViews();
479 std::tuple<int64_t, int64_t> SelectSwapchainPixelFormats();
489 Swapchain_t CreateSwapchain(int64_t format, uint32_t width, uint32_t
height, uint32_t sampleCount,
490 XrSwapchainCreateFlags createFlags, XrSwapchainUsageFlags usageFlags);
497 bool CreateReferenceSpace();
500 bool LoadControllerModels();
506 bool CreateOneActionSpace(
const XrAction& action,
const XrPath& subactionPath,
507 const XrPosef& poseInActionSpace, XrSpace& space);
514 bool CreateSubactionPaths();
522 uint32_t WaitAndAcquireSwapchainImage(
const XrSwapchain& swapchainHandle);
526 constexpr
static XrFormFactor FormFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY;
529 constexpr
static XrViewConfigurationType ViewType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO;
532 constexpr
static uint32_t StereoViewCount = 2;
537 XrReferenceSpaceType ReferenceSpaceType = XR_REFERENCE_SPACE_TYPE_STAGE;
557 bool RenderingBackendExtensionSupported =
false;
566 bool DepthExtensionSupported{
false };
567 bool ControllerModelExtensionSupported{
false };
568 bool UnboundedRefSpaceSupported{
false };
569 bool SpatialAnchorSupported{
false };
570 bool HandInteractionSupported{
false };
571 bool HandTrackingSupported{
false };
572 bool RemotingSupported{
false };
573 bool SceneUnderstandingSupported{
false };
574 bool SceneMarkerSupported{
false };
575 } OptionalExtensions;
587 uint32_t Height{ 0 };
599 XrViewState ViewState{ XR_TYPE_VIEW_STATE };
618 XrActionSet* ActiveActionSet =
nullptr;
626 bool SessionRunning =
false;
632 bool ShouldRenderCurrentFrame =
false;
635 bool StorePoseVelocities =
false;
645 VTK_ABI_NAMESPACE_END
Singleton class that holds a collection of utility functions and member variables to communicate with...
std::unique_ptr< RenderResources_t > RenderResources
std::vector< XrActionSet > ActionSets
std::vector< XrViewConfigurationView > ConfigViews
const std::array< XrPath, 2 > & GetSubactionPaths()
void SetConnectionStrategy(vtkOpenXRManagerConnection *cs)
Set/Get the connection strategy.
void SetGraphicsStrategy(vtkOpenXRManagerGraphics *gs)
Set/Get the rendering backend strategy.
uint32_t GetViewCount()
Return the number of OpenXR views (typically one per physical display / eye)
static vtkOpenXRManager & GetInstance()
Return the singleton instance.
std::array< XrPath, 2 > SubactionPaths
XrTime GetPredictedDisplayTime() const
Return runtime predicted display time for next frame.
Swapchain structure storing information common to all rendering backend.
const XrSession & GetSession()
Return the OpenXR Session.
XrSpace GetReferenceSpace() const
Return XrSpace associated with the XrSession.
XrTime PredictedDisplayTime
Store the frame predicted display time in WaitAndBeginFrame To get the action data at this time and t...
std::vector< XrView > Views
std::vector< XrCompositionLayerDepthInfoKHR > DepthInfoViews
vtkOpenXRManagerGraphics * GetGraphicsStrategy()
Set/Get the rendering backend strategy.
bool IsSessionRunning()
Return true if the OpenXR session is currently running, ie.
XrEnvironmentBlendMode EnvironmentBlendMode
This struct stores all needed information to render the images and send it to the user We can't make ...
bool GetShouldRenderCurrentFrame()
Return true if the current frame should be rendered.
vtkSmartPointer< vtkOpenXRManagerGraphics > GraphicsStrategy
std::vector< Swapchain_t > DepthSwapchains
XrActionStateVector2f _vec2f
vtkOpenXRManagerConnection * GetConnectionStrategy()
Set/Get the connection strategy.
XrSessionState SessionState
const XrPosef * GetViewPose(uint32_t eye)
Returns a pointer to the view pose that contains the view orientation and position for the specified ...
OpenXR manager graphics implementation.
OpenXR manager connection no-op implementation.
std::vector< XrCompositionLayerProjectionView > ProjectionLayerViews
std::vector< Swapchain_t > ColorSwapchains
const XrInstance & GetXrRuntimeInstance()
Return the instance used to communicate with the runtime.
vtkSmartPointer< vtkOpenXRManagerConnection > ConnectionStrategy
XrSystemId GetSystemID() const
Return OpenXR System ID associated with the XrSession.
bool IsSceneUnderstandingSupported()
Return true if the runtime supports the scene understanding extension.
bool IsDepthExtensionSupported()
Return true if the runtime supports the depth extension.
vtkOpenXRSceneObserver is a wrapper around OpenXR scene understanding extensions
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...
XrActionStateBoolean _boolean
XrActionStateFloat _float
Defines the OpenXR types and extensions common to all platforms.