Skip to content
/ VTK Public

Commit 9bd64d6

Browse files
committed
Cleanup and rework of the VRInteractorStyle and subclasses
Reparent the OpenXRInteractorStyle to be a subclass of VRInteractorStyle. Remove lots of duplicated code Rework the TrackedDevice/Device code to be more generic and flexible so that future APIs can work with it. Fix a memory leak in the VRHardwarePicker.
1 parent fc8c31a commit 9bd64d6

17 files changed

+382
-1731
lines changed

Rendering/OpenVR/vtkOpenVRControlsHelper.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void vtkOpenVRControlsHelper::InitControlPosition()
5656
vtkEventDataDevice controller = this->Device;
5757

5858
// Get the active controller model
59-
vtkVRModel* mod = renWin->GetTrackedDeviceModel(controller);
59+
vtkVRModel* mod = renWin->GetModelForDevice(controller);
6060

6161
// Hide controls tooltips if the controller is off
6262
if (!mod)
@@ -86,7 +86,7 @@ void vtkOpenVRControlsHelper::InitControlPosition()
8686

8787
// Get the controller state
8888
renWin->GetHMD()->GetControllerState(
89-
renWin->GetTrackedDeviceIndexForDevice(controller), &cstate, sizeof(cstate));
89+
renWin->GetDeviceHandleForDevice(controller), &cstate, sizeof(cstate));
9090

9191
// Get the component state
9292
renWin->GetOpenVRRenderModels()->GetComponentState(

Rendering/OpenVR/vtkOpenVRRenderWindow.cxx

Lines changed: 126 additions & 154 deletions
Large diffs are not rendered by default.

Rendering/OpenVR/vtkOpenVRRenderWindow.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,14 @@ class VTKRENDERINGOPENVR_EXPORT vtkOpenVRRenderWindow : public vtkVRRenderWindow
151151
*/
152152
vr::IVRRenderModels* GetOpenVRRenderModels() { return this->OpenVRRenderModels; }
153153

154-
/**
155-
* Get the EventDataDevice corresponding to the OpenVR index
156-
*/
157-
vtkEventDataDevice GetDeviceFromDeviceIndex(vr::TrackedDeviceIndex_t index);
158-
159-
/**
160-
* Get the index corresponding to the tracked device.
161-
*/
162-
uint32_t GetTrackedDeviceIndexForDevice(vtkEventDataDevice dev, uint32_t index = 0) override;
163-
164-
/**
165-
* Get the number of tracked devices of the given device type.
166-
*/
167-
uint32_t GetNumberOfTrackedDevicesForDevice(vtkEventDataDevice dev);
168-
169154
/**
170155
* Render the controller and base station models.
171156
*/
172157
void RenderModels() override;
173158

159+
uint32_t GetDeviceHandleForOpenVRHandle(vr::TrackedDeviceIndex_t index);
160+
vtkEventDataDevice GetDeviceForOpenVRHandle(vr::TrackedDeviceIndex_t ohandle);
161+
174162
protected:
175163
vtkOpenVRRenderWindow();
176164
~vtkOpenVRRenderWindow() override = default;

0 commit comments

Comments
 (0)