VTK  9.3.0
vtkOpenXRRenderWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
33#ifndef vtkOpenXRRenderWindow_h
34#define vtkOpenXRRenderWindow_h
35
36#include "vtkRenderingOpenXRModule.h" // For export macro
37#include "vtkVRRenderWindow.h"
38
39#include "vtkEventData.h" // for method sig
40
41#include <array> // array
42
43VTK_ABI_NAMESPACE_BEGIN
44class vtkMatrix4x4;
45
46class VTKRENDERINGOPENXR_EXPORT vtkOpenXRRenderWindow : public vtkVRRenderWindow
47{
48public:
51
56
60 void AddRenderer(vtkRenderer*) override;
61
66 void StereoUpdate() override;
67
72 void StereoMidpoint() override;
73
78 void StereoRenderComplete() override;
79
84 void Render() override;
85
92 void Initialize() override;
93
99 void Finalize() override;
100
104 const char* ReportCapabilities() override { return "OpenXR System"; }
105
109 bool GetSizeFromAPI() override;
110
116 vtkTypeBool GetEventPending() override { return 0; }
117
121 void SetModelActiveState(const int hand, bool state) { this->ModelsActiveState[hand] = state; }
122
123 uint32_t GetDeviceHandleForOpenXRHandle(uint32_t index);
125
131 void UpdateHMDMatrixPose() override;
132
136 void RenderModels() override;
137
138protected:
141
142 // Create one framebuffer per view
143 bool CreateFramebuffers(uint32_t viewCount = 2) override;
144
146 void RenderFramebuffer(FramebufferDesc& framebufferDesc) override;
147
148 virtual void RenderOneEye(uint32_t eye);
149
151
152 // Store if a model is active or not here as openxr do not have a concept
153 // of active/inactive controller
154 std::array<bool, 2> ModelsActiveState = { true, true };
155
156private:
158 void operator=(const vtkOpenXRRenderWindow&) = delete;
159};
160
161VTK_ABI_NAMESPACE_END
162#endif
163// VTK-HeaderTest-Exclude: vtkOpenXRRenderWindow.h
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:51
OpenXR rendering window.
static vtkOpenXRRenderWindow * New()
void RenderFramebuffer(FramebufferDesc &framebufferDesc) override
void Render() override
Overridden to not release resources that would interfere with an external application's rendering.
void StereoUpdate() override
Update the system, if needed, due to stereo rendering.
~vtkOpenXRRenderWindow() override
virtual void RenderOneEye(uint32_t eye)
bool BindTextureToFramebuffer(FramebufferDesc &framebufferDesc)
vtkTypeBool GetEventPending() override
Check to see if a mouse button has been pressed or mouse wheel activated.
void AddRenderer(vtkRenderer *) override
Add a renderer to the list of renderers.
const char * ReportCapabilities() override
Get report of capabilities for the render window.
bool CreateFramebuffers(uint32_t viewCount=2) override
void Finalize() override
Finalize the rendering window.
vtkRenderWindowInteractor * MakeRenderWindowInteractor() override
Create an interactor to control renderers in this window.
void UpdateHMDMatrixPose() override
Update the HMD pose based on hardware pose and physical to world transform.
void StereoRenderComplete() override
Handles work required once both views have been rendered when using stereo rendering.
void SetModelActiveState(const int hand, bool state)
Set the active state (active: true / inactive: false) of the specified hand.
void Initialize() override
Initialize the rendering window.
uint32_t GetDeviceHandleForOpenXRHandle(uint32_t index)
vtkEventDataDevice GetDeviceForOpenXRHandle(uint32_t ohandle)
vtkNew< vtkMatrix4x4 > TempMatrix4x4
void StereoMidpoint() override
Intermediate method performs operations required between the rendering of the left and right eye.
bool GetSizeFromAPI() override
Get size of render window from OpenXR.
void RenderModels() override
Render the controllers.
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
Definition vtkRenderer.h:59
VR rendering window.
int vtkTypeBool
Definition vtkABI.h:64
vtkEventDataDevice
platform-independent event data structures
#define VTK_NEWINSTANCE