Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements and Refactoring for XR Runtimes Integration #149

Merged
merged 41 commits into from
Dec 30, 2023

Commits on Dec 27, 2023

  1. Configuration menu
    Copy the full SHA
    38e793f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4025985 View commit details
    Browse the repository at this point in the history
  3. ENH: Remove interactor style GetMappedAction available in base class

    The function `GetMappedAction()` is added to the vtkVRInteractorStyle
    base class through MR-10784.
    
    See https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10784
    jcfr committed Dec 27, 2023
    Configuration menu
    Copy the full SHA
    833aa02 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    986a439 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d1a4d40 View commit details
    Browse the repository at this point in the history
  6. ENH: Remove obsolete "GestureEnabledButtons" ivar from interactor class

    Removes "GestureEnabledButtons" ivar that became obsolete following
    these commits:
    * c5c6d6f ("BUG: Restore complex gesture support", 2023-01-29),
    * 22eba9f ("BUG: Fix integration with updated Slicer event delegation and VTK OpenVR API (KitwareMedical#131)", 2023-12-21)
    * 0fa6102 ("BUG: Ensure handling of gesture triggers the "End" event", 2023-12-20)
    * 512efe6 ("BUG: Do not report "Unrecognized device" if handling complex gesture", 2023-12-20)
    
    For reference, it was originally introduced in 43bef4b ("ENH: Make trigger
    button configurable", 2019-01-11).
    jcfr committed Dec 27, 2023
    Configuration menu
    Copy the full SHA
    dee0fb2 View commit details
    Browse the repository at this point in the history
  7. ENH: Remove interactor GetCurrentGesture available in base class

    The function `GetCurrentGesture()` is added to the vtkVRRenderWindowInteractor
    base class through MR-10786.
    
    See https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10786
    jcfr committed Dec 27, 2023
    Configuration menu
    Copy the full SHA
    50330d2 View commit details
    Browse the repository at this point in the history

Commits on Dec 28, 2023

  1. Configuration menu
    Copy the full SHA
    c1c7959 View commit details
    Browse the repository at this point in the history
  2. ENH: Relocate CalculateCombinedControllerPose" into logic class

    Since OpenXR and OpenVR runtime each require their own instance of
    interactor style, this commit relocates is a step toward reducing the
    amount of code that will be duplicated.
    jcfr committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    3a9480f View commit details
    Browse the repository at this point in the history
  3. ENH: Relocate "GestureButton" configuration functions to logic class

    Since OpenXR and OpenVR runtime each require their own instance of
    interactor style, this commit is a step toward reducing the amount
    of code specific to the interactor.
    
    The is made possible after the following vtkOpenVRRenderWindowInteractor
    updates:
    
    * Declare AddAction() functions as virtual.
      See https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10785
    
    * Mark ComplexGesture recognition functions as public.
      See https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10786
    
    For reference, the "GestureButton" configuration functions were
    introduced through these commites:
    * 43bef4b ("ENH: Make trigger button configurable", 2019-01-11)
    * e268168 ("ENH: Add python-accessible functions to capture vr
      controller events, associate buttons with gestures and enable/disable
      interaction.", 2019-05-30)
    jcfr committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    ed70b61 View commit details
    Browse the repository at this point in the history
  4. ENH: Add vtkVirtualRealityComplexGestureRecognizer

    Update the RenderWindowInteractor to use the recognizer. This will allow
    to have dedicated interactor for OpenVR and OpenXR runtime wihout any
    code duplication.
    jcfr committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    957b261 View commit details
    Browse the repository at this point in the history
  5. DOC: Removing obsolete comments related to original interactor debugging

    Following 22eba9f (BUG: Fix integration with updated Slicer event
    delegation and VTK OpenVR API), the VirtualReality interactor style
    derives from `vtkOpenVRInteractorStyle` and all the upstream
    capabilities are now available.
    jcfr committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    85843cb View commit details
    Browse the repository at this point in the history
  6. ENH: Cleanup createRenderWindow re-ordering calls and adding comments

    Also removes redundant call `InteractorStyle->SetInteractor(this->Interactor)`
    Calling `Interactor->SetInteractorStyle(this->InteractorStyle)` is sufficient.
    jcfr committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    1ece06b View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2023

  1. ENH: Add vtkVirtualRealityViewInteractorStyleDelegate

    Update the InteractorStyle to use a delegate implementing the common
    logic related to processing of the "Pinch3D" complex gesture, handling of
    the "PositionProp" interaction and update of the view magnification. This
    will allow to have dedicated interactor styles for OpenVR and OpenXR
    runtime without code duplication.
    jcfr committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    3b51503 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8b5557f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7787292 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b718296 View commit details
    Browse the repository at this point in the history
  5. COMP: Cleanup header includes

    Group headers and remove unused ones.
    
    Consistently use "VR [Logic|MRML|MRMLDM|Widgets] includes" comment to
    introduce headers from this extension.
    
    Re-order include groups and sort alphabetically within groups.
    
    Remove `vr::TrackedDevicePose_t` forward declaration that became
    obsolete following commit 0c8c2e8 ("ENH: Decouple update of transform
    node matrix and attributes", 2023-12-26)
    jcfr committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    23d1a00 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3d8132c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e2d3ba6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    39ba1c8 View commit details
    Browse the repository at this point in the history
  9. ENH: Associate VirtualRealityLogic with VirtualRealityView

    This is done anticipating subsequent refactoring in which the computation
    of the ActionManifestPath will be moved to the logic.
    jcfr committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    290567a View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2023

  1. ENH: Add support for runtime-specific action manifest path

    Update VirtualReality logic adding `ComputeActionManifestPath()` utility
    function and update VirtualRealityView to compute the path based on the
    XR runtime.
    
    To support computing the path based on the module install state, the
    `ModuleInstalled` property was also added.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    1684fa8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0dab065 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    42c2ec8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f1dd001 View commit details
    Browse the repository at this point in the history
  5. ENH: Consolidate & simplify logic for RenderWindow creation

    This commit streamlines the process of creating a RenderWindow in the
    qMRMLVirtualRealityView class by making several improvements:
    
    - Reorganize the update of QCursor in the `createRenderWindow()` function
      around the time-consuming `RenderWindow->Initialize()` call.
    
    - Set the view node's Error status directly within `createRenderWindow()`,
      and check for view node errors before returning from `updateWidgetFromMRML()`.
    
    - Enhance `destroyRenderWindow()` to gracefully handle calls without
      instantiated objects.
    
    - Update `createRenderWindow()` to set a view node error if the XR runtime is
      undefined and RenderWindow creation did not occur.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    ce0c1bc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    12b6201 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1ed0776 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    139daa5 View commit details
    Browse the repository at this point in the history
  9. ENH: Initialize XR Runtime based on the corresponding view node property

    Since we systematically attempt to initialize the runtime if it is
    "UndefinedXRRuntime" or if it has changed, this commit also adds support
    for checking for the maximum initialization attempts and avoid recursion.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    ab512ad View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c7a6cb1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    107a105 View commit details
    Browse the repository at this point in the history
  12. ENH: Update UI with XR Runtime selection combox

    Users can now conveniently select and update the current XR Runtime.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    fe6eb83 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    7dae050 View commit details
    Browse the repository at this point in the history
  14. ENH: Eliminate explicit OpenVR dependency in TransformWidget

    This commit removes the explicit dependency on the "openvr.h" header in the
    TransformWidget. However, it's essential to note that tracking results
    are not standardized, and the status will consistently be reported as
    "off" for XR runtimes other than OpenVR.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    7f3e673 View commit details
    Browse the repository at this point in the history
  15. ENH: Simplify event loop introducing shouldConsiderQuickViewMotion()

    For reference, the function was originally introduced in
    commit 46b252d ("Added progressive rendering", 2018-04-20)
    
    Also renamed ivar from `viewUpDirectionChangeSpeed` to `viewUpChangeSpeed`
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    3b94848 View commit details
    Browse the repository at this point in the history
  16. ENH: Improve initialization process robustness using `GetVRInitialize…

    …d()`
    
    Since having the head-mounted display (HMD) connected may not always be
    a good proxy to check if the initialization succeeded, we instead swith to
    the dedicated `GetVRInitialized` function available since commit
    Kitware/VTK@bddd94efd3 ("Improve OpenVR/OpenXR module and test and enable
    OpenXR in CI", 2023-01-11)
    
    Moreover, the determination of whether the event loop should run has been
    refined by relying on the GetVRInitialized function as the primary criterion.
    In the case of the OpenVR runtime, the use of GetHMD is retained through the
    introduction of the `hmdConnected` internal variable for enhanced flexibility.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    e0fe654 View commit details
    Browse the repository at this point in the history
  17. ENH: Introduce CMake option for toggling "OpenVR" support

    - Introduce the CMake option `SlicerVirtualReality_HAS_OPENVR_SUPPORT`,
      initialized to OFF on macOS.
    
    - Introduce `vtkMRMLVirtualRealityConfigure.h`, a configurable header
      facilitating conditional compilation based on the presence of the macro
      `SlicerVirtualReality_HAS_OPENVR_SUPPORT`.
    
    - Update `vtkVirtualRealityViewInteractorObserver::GetInteractorStyleDelegate`
      to dynamically return the current delegate based on the availability
      of OpenVR support.
    
    - Ensure that when OpenVR support is disabled, proper linkage against
      the `VTK::RenderingVR` target is maintained, providing a backend-agnostic
      interface.
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    db20342 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    fa756b0 View commit details
    Browse the repository at this point in the history
  19. ENH: Add support for "OpenXR" XR runtime

    - Add SlicerVirtualReality_HAS_OPENXR_SUPPORT CMake option
    
    - Add OpenXR-SDK and vtkRenderingOpenXR external projects
    
    - Add OpenXR specialized interactor style class for.
    
    - Add OpenXR specialized interactor class. Thanks to the shared
      `vtkVirtualRealityComplexGestureRecognizer`, there is no duplicated code.
    
    - Add OpenXR specialized interactor style class. Thanks to the shared
      `vtkVirtualRealityViewInteractorStyleDelegate`, there is no duplicated code.
    
    - Update vtkSlicerVirtualRealityLogic::ComputeActionManifestPath support
      for `OpenXR`.
    
    - Update `vtkMRMLVirtualRealityViewNode` adding `OpenXR` to `XRRuntimeType` enum
    
    - Update `qMRMLVirtualRealityView::createRenderWindow` to instantiate `vtkOpenXR*` classes
    
    - Update  `qMRMLVirtualRealityView::currentXRRuntime` to check for OpenXR
    jcfr committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    e60325e View commit details
    Browse the repository at this point in the history