Skip to content
/ VTK Public
forked from Kitware/VTK

[slicer-5.6-v9.2.20230607-1ff325c54-2] Update VTK backporting VR, OpenVR and OpenXR improvements #50

Merged
jcfr merged 16 commits intoSlicer:slicer-5.6-v9.2.20230607-1ff325c54-2from
jcfr:slicer-5.6-v9.2.20230607-1ff325c54-2-vr-backports
Dec 30, 2023
Merged

[slicer-5.6-v9.2.20230607-1ff325c54-2] Update VTK backporting VR, OpenVR and OpenXR improvements #50
jcfr merged 16 commits intoSlicer:slicer-5.6-v9.2.20230607-1ff325c54-2from
jcfr:slicer-5.6-v9.2.20230607-1ff325c54-2-vr-backports

Conversation

@jcfr
Copy link
Member

@jcfr jcfr commented Dec 30, 2023

These changes correspond to commits directly pushed to the slicer-v9.2.20230607-1ff325c54-2 and integrated in Slicer through these pull requests:


For convenience, description of the associated pull requests are copied below.

Pull request #7514

Updates VTK to support the integration of multiple runtime into the SlicerVirtualReality extension.

The following merge requests, including the backported commits referenced below, have been submitted to upstream VTK for reference

List of VTK changes:

$ git shortlog 573f18292..2f050efc8 --no-merges
Jean-Christophe Fillion-Robin (11):
      [Backport MR-10784] VR: Update interactor style API adding GetMappedAction()
      [Backport MR-10785] VR: Declare AddAction() functions as virtual
      [Backport MR-10786] VR: Mark ComplexGesture recognition functions as public
      [Backport MR-10786] VR: Add GetCurrentGesture() API for retrieving the gesture being recognized
      [Backport MR-10786] VR: Add SetCurrentGesture() API for setting the gesture being recognized
      [Backport MR-10786] VR: Add GetDeviceInputDownCount() API
      [Backport MR-10786] VR: Add SetDeviceInputDownCount() API
      [Backport MR-10786] VR: Add SetStartingPhysicalToWorldMatrix() API
      [Backport MR-10786] VR: Add SetStartingPhysicalEventPose() API
      [Backport MR-10789] VR: Add SetInteractionState() API to VR interactor style
      [Backport MR-10789] VR: Improve robustness of GetInteractionState() by checking input

Pull request #7516

Updates VTK to support integration of the OpenXR runtime into the SlicerVirtualReality extension.

The following merge requests, including the backported commits referenced below, have been submitted to upstream VTK for reference

Additionally this commit also adds the OpenXR bindings for the oculus touch controller copied from Kitware/ParaView@ec4111e7c. See Plugins/XRInterface/Plugin/pv_openxr_binding_oculus_touch_controller.json.

List of VTK changes:

$ git shortlog 2f050efc8..b9aae674d --no-merges
Jean-Christophe Fillion-Robin (5):
      Revert "[Backport MR-10785] VR: Declare AddAction() functions as virtual"
      [Backport MR-10785] VR: Improve consistency in OpenVR interactor AddAction()
      [Backport MR-10785] VR: Declare AddAction() functions as virtual
      [Backport MR-10794] VR: Resolve "Not rendered" warnings after XR RenderWindow Initialization
      [SlicerVirtualReality] ENH: Add OpenXR bindings for oculus_touch

jcfr added 16 commits December 29, 2023 23:52
…ction()

Adds public API to support querying which interaction state `VTKIS_*STATE*`
is mapped to a given pair `(EventId, EventDataAction)`.

Merge-request: vtk/vtk!10784
(cherry picked from commit b2e3406)
This helps client applications supporting for both OpenXR and OpenVR runtimes.

Merge-request: vtk/vtk!10785
(cherry picked from commit bc22e02)
…public

This helps client applications that are externally re-mapping the
buttons associated with complex gesture.

Merge-request: vtk/vtk!10786
(cherry picked from commit 28945f3)
…e gesture being recognized

This helps client applications redefining the heuristic used to recognized
complex gestures.

Merge-request: vtk/vtk!10786
(cherry picked from commit 32a2899)
…esture being recognized

This helps client applications redefining the heuristic used to recognized
complex gestures.

Merge-request: vtk/vtk!10786
(cherry picked from commit 6a574fe)
This helps client applications redefining the heuristic used to recognized
complex gestures.

This is similar to the existing API for querying the number of pointers down.
See vtkRenderWindowInteractor::GetPointersDownCount()

Merge-request: vtk/vtk!10786
(cherry picked from commit 057d96d)
This helps client applications redefining the heuristic used to recognized
complex gestures.

Merge-request: vtk/vtk!10786
(cherry picked from commit fb85f70)
This helps client applications redefining the heuristic used to recognized
complex gestures.

Merge-request: vtk/vtk!10786
(cherry picked from commit 1fb631c)
This helps client applications redefining the heuristic used to recognized
complex gestures.

Merge-request: vtk/vtk!10786
(cherry picked from commit f09ab08)
…r style

This helps client applications that are externally setting the
interaction states. It allows to more easily share custom interactor style
logic common to both OpenVR and OpenXR runtime.

Merge-request: vtk/vtk!10789
(cherry picked from commit 5768bdf)
…y checking input

Follows up on commit 1aac3fe (Create VRInteractorStyle and VRRenderWindowInteractor)
in which the method `GetInteractionState()` was introduced.

Merge-request: vtk/vtk!10789
(cherry picked from commit 2f050ef)
…ual"

This reverts commit bc22e02.

(cherry picked from commit 8b6d78d)
…ction()

This commit improves consistency in the signature of the OpenVR interactor's
`AddAction()` function. The update ensures backward compatibility and aligns
the function with its counterpart in other interactors.

This change sets the stage for a subsequent commit that will update the
base class, introducing a virtual interface for adding actions.

This change is backward compatible and intended to improve consistency
between the signature of the function in both interactors.

And is done anticipating a subsequent commit updating the base class
to add a virtual interface for adding action.

Merge-request: vtk/vtk!10785
(cherry picked from commit 64c0ef6)
This commit virtualizes the `AddAction()` functions in the VR
interactor. The addition of the `isAnalog` parameter aims to facilitate
client applications that support both OpenXR and OpenVR runtimes. Although
the `isAnalog` parameter is ignored in the context of the OpenXR interactor,
these signatures are designed to meet the requirements of the base class
interface.

Merge-request: vtk/vtk!10785
(cherry picked from commit 16fa4f1)
…erWindow Initialization

This commit addresses warnings in the OpenXR rendering pipeline that
occurred immediately after initialization. In such cases, when the
`XrFrameState.shouldRender` property, used to set the `ShouldRenderCurrentFrame`
flag, evaluates to False, we eliminate explicit use of the `vtkWarningMacro`.
This prevents warnings like the following from being reported after
a standard pipeline initialization:

```
Warning: In vtkOpenXRRenderWindow.cxx, line 189
vtkOpenXRRenderWindow (0000028A641868D0): Not rendered
```

This resolves issue vtk/vtk#19112 (OpenXR Renderer: always warn "Not rendered"
at startup). Additionally, the associated docstring for the
`ShouldRenderCurrentFrame` instance variable has been updated for clarity.

Furthermore, the flag "ShouldRenderCurrentFrame" is proactively reset to avoid
any attempted rendering if the function `WaitAndBeginFrame()`, used in
`vtkOpenXRRenderWindow::Render`, exits prematurely.

For more details on `XrFrameState` and `XrFrameBeginInfo`, refer to the
OpenXR specification:
- https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrFrameState.html
- https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrFrameBeginInfo.html

Merge-request: vtk/vtk!10794
(cherry picked from commit 2baaba8)
@jcfr jcfr merged commit eef17b2 into Slicer:slicer-5.6-v9.2.20230607-1ff325c54-2 Dec 30, 2023
@jcfr jcfr deleted the slicer-5.6-v9.2.20230607-1ff325c54-2-vr-backports branch December 30, 2023 05:00
@jcfr
Copy link
Member Author

jcfr commented Dec 30, 2023

Corresponding changes have been fetched in the VTK checkout found in the Stable release build tree on

  • metroplex (Linux)
  • computron (macOS)
  • overload (Windows).

For example, here is the output of the git pull on computron

$ git pull origin slicer-5.6-v9.2.20230607-1ff325c54-2 
[...]
From https://github.com/slicer/VTK
 * branch                  slicer-5.6-v9.2.20230607-1ff325c54-2 -> FETCH_HEAD
   4d4bdb3928..eef17b2698  slicer-5.6-v9.2.20230607-1ff325c54-2 -> origin/slicer-5.6-v9.2.20230607-1ff325c54-2
Updating 4d4bdb3928..eef17b2698
Fast-forward
 Rendering/OpenVR/vtkOpenVRRenderWindowInteractor.cxx             |   4 ++--
 Rendering/OpenVR/vtkOpenVRRenderWindowInteractor.h               |   5 +++--
 Rendering/OpenXR/CMakeLists.txt                                  |   1 +
 Rendering/OpenXR/vtkOpenXRManager.cxx                            |   4 ++++
 Rendering/OpenXR/vtkOpenXRManager.h                              |   7 +++++--
 Rendering/OpenXR/vtkOpenXRRenderWindow.cxx                       |   4 ----
 Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.cxx             |  14 ++++++++++++++
 Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.h               |  15 ++++++++++++++-
 Rendering/OpenXR/vtk_openxr_actions.json                         |   4 ++++
 Rendering/OpenXR/vtk_openxr_binding_oculus_touch_controller.json |  81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Rendering/VR/vtkVRInteractorStyle.cxx                            |  43 +++++++++++++++++++++++++++++++------------
 Rendering/VR/vtkVRInteractorStyle.h                              |  20 ++++++++++++++++++++
 Rendering/VR/vtkVRRenderWindowInteractor.cxx                     | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
 Rendering/VR/vtkVRRenderWindowInteractor.h                       |  79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 14 files changed, 338 insertions(+), 50 deletions(-)
 create mode 100644 Rendering/OpenXR/vtk_openxr_binding_oculus_touch_controller.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant