Skip to content
/ VTK Public

Commit bddd94e

Browse files
committed
Improve OpenVR/OpenXR module and test and enable OpenXR in CI
- Enable OpenXR in fedora standard CI - Introduce new OpenXR/OpenVR tests and CMake options to control which test to run - Only instanciation tests are run in CI for now, rendering tests are not run in CI yet. - Rendering test do not require to set HMD position as they render a sphere which looks the same from wherever - Fix action .json files location in build and install so it can be used in tests - Fix multiples issues with Initialize/Finalize code - Fix issues with Render method virtual logic - Add baselines for index, mixed reality and monado (openxr only) - Tested with ParaView XRInterface plugin manually
1 parent 29ba958 commit bddd94e

File tree

46 files changed

+982
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+982
-440
lines changed

.gitlab/ci/configure_el8.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# catalyst is not installed on el8 image
22
set(VTK_ENABLE_CATALYST OFF CACHE BOOL "")
33

4+
# OpenXR is not installed on el8 image
5+
set(VTK_MODULE_ENABLE_VTK_RenderingOpenXR NO CACHE STRING "")
6+
47
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora_common.cmake")

.gitlab/ci/configure_fedora34_cuda_mpi_offscreen_osmesa.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ set(CMAKE_CUDA_ARCHITECTURES 60 CACHE STRING "")
44
# catalyst is not installed on cuda image
55
set(VTK_ENABLE_CATALYST OFF CACHE BOOL "")
66

7+
# OpenXR do not support OSMesa
8+
set(VTK_MODULE_ENABLE_VTK_RenderingOpenXR NO CACHE STRING "")
9+
710
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora34.cmake")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Qt doesn't support OSMesa.
22
set(VTK_GROUP_ENABLE_Qt NO CACHE STRING "")
33

4+
# OpenXR do not support OSMesa
5+
set(VTK_MODULE_ENABLE_VTK_RenderingOpenXR NO CACHE STRING "")
6+
47
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora34.cmake")

.gitlab/ci/configure_fedora_common.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Modules which require software not in the CI image.
22
set(VTK_MODULE_ENABLE_VTK_RenderingRayTracing NO CACHE STRING "") # ospray
3-
set(VTK_MODULE_ENABLE_VTK_RenderingOpenXR NO CACHE STRING "") # OpenXR
43
set(VTK_MODULE_ENABLE_VTK_RenderingZSpace NO CACHE STRING "") # zSpace
54
set(VTK_MODULE_ENABLE_VTK_IOOCCT NO CACHE STRING "") # occt
65
# FindOpenVDB is not installed.

Rendering/OpenVR/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ set(openvr_input_files
3636
foreach(inputfile IN LISTS openvr_input_files)
3737
configure_file(
3838
"${CMAKE_CURRENT_SOURCE_DIR}/${inputfile}"
39-
"${CMAKE_BINARY_DIR}/${input_file}"
39+
"${CMAKE_CURRENT_BINARY_DIR}/${input_file}"
4040
COPYONLY)
4141
endforeach()
4242

4343
install(
4444
FILES ${openvr_input_files}
45-
DESTINATION "${CMAKE_INSTALL_BINDIR}"
45+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/vr_actions/"
4646
COMPONENT runtime
4747
)
4848
vtk_add_test_mangling(VTK::RenderingOpenVR)
Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
vtk_add_test_cxx(vtkRenderingOpenVRCxxTests tests
1+
# The runtime tests requires an OpenVR runtime and a HMD to pass
2+
# Do not turn on controllers to avoid any issue with the image comparison
3+
# Tested with :
4+
# - Valve Index on Windows
5+
# - Windows Mixed Reality within SteamVR
6+
option(VTK_OPENVR_TESTING_ENABLE_RUNTIME_TESTS "Enable OpenVR tests that require an OpenVR runtime" OFF)
7+
mark_as_advanced(VTK_OPENVR_TESTING_ENABLE_RUNTIME_TESTS)
8+
9+
# The interactive tests require an OpenVR runtime and a HMD and will just run interactively.
10+
# To make it pass, just exit the VR environment using the menu inside VR.
11+
option(VTK_OPENVR_TESTING_ENABLE_INTERACTIVE_TESTS "Enable OpenVR tests that are interactive" OFF)
12+
mark_as_advanced(VTK_OPENVR_TESTING_ENABLE_INTERACTIVE_TESTS)
13+
14+
set(OpenVR_tests
215
TestAvatar.cxx
3-
# Medical.cxx,NO_VALID
4-
)
16+
TestOpenVRInstantiation.cxx,NO_VALID)
17+
18+
if (VTK_OPENVR_TESTING_ENABLE_RUNTIME_TESTS)
19+
list (APPEND OpenVR_tests
20+
TestOpenVRInitialization.cxx,NO_VALID
21+
TestOpenVRRendering.cxx
22+
TestOpenVRRenderingVolume.cxx)
23+
endif ()
524

6-
if (WIN32)
7-
vtk_add_test_cxx(vtkRenderingOpenVRCxxTests tests
8-
TestDragon.cxx,NO_VALID
9-
)
25+
if (VTK_OPENVR_TESTING_ENABLE_INTERACTIVE_TESTS)
26+
list (APPEND OpenVR_tests
27+
TestOpenVRInteractiveBox.cxx,NO_VALID
28+
TestOpenVRInteractiveDragon.cxx,NO_VALID)
1029
endif ()
1130

12-
vtk_test_cxx_executable(vtkRenderingOpenVRCxxTests tests RENDERING_FACTORY)
31+
vtk_add_test_cxx(vtkRenderingOpenVRCxxTests tests ${OpenVR_tests})
32+
vtk_test_cxx_executable(vtkRenderingOpenVRCxxTests tests)

Rendering/OpenVR/Testing/Cxx/Medical.cxx

Lines changed: 0 additions & 191 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*=========================================================================
2+
3+
Program: Visualization Toolkit
4+
5+
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6+
All rights reserved.
7+
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8+
9+
This software is distributed WITHOUT ANY WARRANTY; without even
10+
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11+
PURPOSE. See the above copyright notice for more information.
12+
13+
=========================================================================*/
14+
15+
#include "vtkOpenVRCamera.h"
16+
#include "vtkOpenVRRenderWindow.h"
17+
#include "vtkOpenVRRenderWindowInteractor.h"
18+
#include "vtkOpenVRRenderer.h"
19+
20+
//------------------------------------------------------------------------------
21+
// Only initialize, requires a OpenVR implementation but do not render anything
22+
int TestOpenVRInitialization(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
23+
{
24+
vtkNew<vtkOpenVRRenderer> renderer;
25+
vtkNew<vtkOpenVRRenderWindow> renderWindow;
26+
vtkNew<vtkOpenVRCamera> cam;
27+
vtkNew<vtkOpenVRRenderWindowInteractor> iren;
28+
vtkNew<vtkActor> actor;
29+
30+
renderer->SetActiveCamera(cam);
31+
renderer->AddActor(actor);
32+
renderWindow->AddRenderer(renderer);
33+
iren->SetRenderWindow(renderWindow);
34+
iren->SetActionManifestDirectory("../../");
35+
36+
renderWindow->Initialize();
37+
if (renderWindow->GetHMD())
38+
{
39+
iren->Initialize();
40+
}
41+
else
42+
{
43+
return 1;
44+
}
45+
46+
return 0;
47+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*=========================================================================
2+
3+
Program: Visualization Toolkit
4+
5+
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6+
All rights reserved.
7+
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8+
9+
This software is distributed WITHOUT ANY WARRANTY; without even
10+
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11+
PURPOSE. See the above copyright notice for more information.
12+
13+
=========================================================================*/
14+
15+
#include "vtkOpenVRCamera.h"
16+
#include "vtkOpenVRRenderWindow.h"
17+
#include "vtkOpenVRRenderWindowInteractor.h"
18+
#include "vtkOpenVRRenderer.h"
19+
20+
//------------------------------------------------------------------------------
21+
// Only instanciates, do not requires a OpenVR implementation to run
22+
int TestOpenVRInstantiation(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
23+
{
24+
vtkNew<vtkOpenVRRenderer> renderer;
25+
vtkNew<vtkOpenVRRenderWindow> renderWindow;
26+
vtkNew<vtkOpenVRCamera> cam;
27+
vtkNew<vtkOpenVRRenderWindowInteractor> iren;
28+
vtkNew<vtkActor> actor;
29+
30+
renderer->SetActiveCamera(cam);
31+
renderer->AddActor(actor);
32+
renderWindow->AddRenderer(renderer);
33+
iren->SetRenderWindow(renderWindow);
34+
return 0;
35+
}

0 commit comments

Comments
 (0)