13 #ifndef vtkOpenXRManager_h
14 #define vtkOpenXRManager_h
16 #include "vtkRenderingOpenXRModule.h"
30 VTK_ABI_NAMESPACE_BEGIN
43 return UniqueInstance;
59 bool XrCheckOutput(OutputLevel
level,
const XrResult&,
const std::string& message);
66 void PrintInstanceProperties();
67 void PrintSystemProperties(XrSystemProperties* system_properties);
68 void PrintSupportedViewConfigs();
69 void PrintViewConfigViewInfo(
const std::vector<XrViewConfigurationView>&);
70 bool PrintReferenceSpaces();
93 std::tuple<uint32_t, uint32_t> GetRecommendedImageRectSize();
100 uint32_t GetRecommendedSampleCount();
108 return static_cast<uint32_t
>(this->RenderResources->ConfigViews.size());
128 if (eye >= this->GetViewCount())
132 return &(this->RenderResources->Views[eye].pose);
144 if (eye >= this->GetViewCount())
148 return &(this->RenderResources->Views[eye].fov);
204 bool WaitAndBeginFrame();
214 bool PrepareRendering(uint32_t eye,
void* colorTextureId,
void* depthTextureId);
222 void ReleaseSwapchainImage(uint32_t eye);
237 bool PollEvent(XrEventDataBuffer& eventData);
261 bool SelectActiveActionSet(
unsigned int index);
268 bool AttachSessionActionSets();
275 void DestroyActionSets();
286 bool CreateOneAction(
295 const std::string&
profile, std::vector<XrActionSuggestedBinding>& actionSuggestedBindings);
314 bool UpdateActionData(
Action_t& action_t,
int hand);
322 bool ApplyVibration(
const Action_t& actionT,
int hand,
float amplitude = 0.5f,
323 float duration = 25000000.0f,
float frequency = XR_FREQUENCY_UNSPECIFIED);
332 NumberOfControllers = 4
345 } States[ControllerIndex::NumberOfControllers];
347 XrSpace PoseSpaces[ControllerIndex::NumberOfControllers];
348 XrSpaceLocation PoseLocations[ControllerIndex::NumberOfControllers];
349 XrSpaceVelocity PoseVelocities[ControllerIndex::NumberOfControllers];
378 bool CreateInstance();
379 std::vector<const char*> SelectExtensions();
386 void PrintOptionalExtensions();
401 bool CreateSystemProperties();
410 bool CreateSession();
418 bool CreateSwapchains();
426 bool CreateConfigViews();
436 std::tuple<int64_t, int64_t> SelectSwapchainPixelFormats();
446 Swapchain_t CreateSwapchain(int64_t format, uint32_t width, uint32_t
height, uint32_t sampleCount,
447 XrSwapchainCreateFlags createFlags, XrSwapchainUsageFlags usageFlags);
454 bool CreateReferenceSpace();
457 bool LoadControllerModels();
463 bool CreateOneActionSpace(
const XrAction& action,
const XrPath& subactionPath,
464 const XrPosef& poseInActionSpace, XrSpace& space);
471 bool CreateSubactionPaths();
479 uint32_t WaitAndAcquireSwapchainImage(
const XrSwapchain& swapchainHandle);
483 constexpr
static XrFormFactor FormFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY;
486 constexpr
static XrViewConfigurationType ViewType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO;
489 constexpr
static uint32_t StereoViewCount = 2;
494 XrReferenceSpaceType ReferenceSpaceType = XR_REFERENCE_SPACE_TYPE_STAGE;
514 bool RenderingBackendExtensionSupported =
false;
523 bool DepthExtensionSupported{
false };
524 bool ControllerModelExtensionSupported{
false };
525 bool UnboundedRefSpaceSupported{
false };
526 bool SpatialAnchorSupported{
false };
527 bool HandInteractionSupported{
false };
528 bool HandTrackingSupported{
false };
529 bool RemotingSupported{
false };
530 } OptionalExtensions;
542 uint32_t Height{ 0 };
554 XrViewState ViewState{ XR_TYPE_VIEW_STATE };
566 std::unique_ptr<RenderResources_t> RenderResources{};
573 XrActionSet* ActiveActionSet =
nullptr;
581 bool SessionRunning =
false;
584 bool ShouldRenderCurrentFrame =
false;
587 bool StorePoseVelocities =
false;
598 VTK_ABI_NAMESPACE_END
This struct stores all needed information to render the images and send it to the user We can't make ...
XrActionStateVector2f _vec2f
static vtkOpenXRManager & GetInstance()
Return the singleton instance.
Singleton class that holds a collection of utility functions and member variables to communicate with...
XrSessionState SessionState
vtkOpenXRManagerGraphics * GetGraphicsStrategy()
Set/Get the rendering backend strategy.
vtkSmartPointer< vtkOpenXRManagerGraphics > GraphicsStrategy
uint32_t GetViewCount()
Return the number of OpenXR views (typically one per physical display / eye)
const XrInstance & GetXrRuntimeInstance()
Return the instance used to communicate with the runtime.
vtkSmartPointer< vtkOpenXRManagerConnection > ConnectionStrategy
bool IsDepthExtensionSupported()
Return true if the runtime supports the depth extension.
std::vector< Swapchain_t > ColorSwapchains
const XrPosef * GetViewPose(uint32_t eye)
Returns a pointer to the view pose that contains the view orientation and position for the specified ...
bool GetShouldRenderCurrentFrame()
Return true if the current frame should be rendered.
vtkOpenXRManagerConnection * GetConnectionStrategy()
Set/Get the connection strategy.
XrEnvironmentBlendMode EnvironmentBlendMode
XrActionStateFloat _float
const std::array< XrPath, 2 > & GetSubactionPaths()
bool IsSessionRunning()
Return true if the OpenXR session is currently running, ie.
Swapchain structure storing information common to all rendering backend.
XrTime PredictedDisplayTime
Store the frame predicted display time in WaitAndBeginFrame To get the action data at this time and t...
std::vector< XrActionSet > ActionSets
XrActionStateBoolean _boolean
std::vector< XrView > Views
std::array< XrPath, 2 > SubactionPaths
OpenXR manager graphics implementation.
const XrSession & GetSession()
Return the OpenXR Session.
OpenXR manager connection no-op implementation.
std::vector< XrViewConfigurationView > ConfigViews
std::vector< Swapchain_t > DepthSwapchains
void SetConnectionStrategy(vtkOpenXRManagerConnection *cs)
Set/Get the connection strategy.
std::vector< XrCompositionLayerDepthInfoKHR > DepthInfoViews
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...
std::vector< XrCompositionLayerProjectionView > ProjectionLayerViews
void SetGraphicsStrategy(vtkOpenXRManagerGraphics *gs)
Set/Get the rendering backend strategy.
Defines the OpenXR types and extensions common to all platforms.