Add build option to show the Dear Imgui demo window in the headset for debugging

This commit is contained in:
Guillaume Meunier
2024-11-01 11:40:33 +01:00
parent 6c10a9ee95
commit 4baff267f6
5 changed files with 18 additions and 1 deletions
+2
View File
@@ -44,6 +44,8 @@ option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
option(WIVRN_SHOW_IMGUI_DEMO_WINDOW "Show the Dear ImGui demo window in the client" OFF)
option(WIVRN_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH OFF)
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
+3 -1
View File
@@ -74,6 +74,7 @@ android {
versionName = project.hasProperty('wivrn_version') ? wivrn_version : "1.0"
versionCode = project.hasProperty('wivrn_versionCode') ? wivrn_versionCode.toInteger() : 1
def showImguiDemo = project.hasProperty('wivrn_show_imgui_demo') ? wivrn_show_imgui_demo : 'OFF'
externalNativeBuild {
cmake {
@@ -86,7 +87,8 @@ android {
'-DWIVRN_BUILD_CLIENT=ON',
'-DWIVRN_BUILD_SERVER=OFF',
'-DWIVRN_BUILD_DASHBOARD=OFF',
'-DWIVRN_WERROR=ON'
'-DWIVRN_WERROR=ON',
'-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo
resValue "string", "app_name", "WiVRn"
}
}
+6
View File
@@ -740,6 +740,12 @@ void imgui_context::new_frame(XrTime display_time)
draw_list->AddCircle(position_distance->first, radius * 1.2, ImGui::GetColorU32(ImVec4(0, 0, 0, alpha)), 0, radius * 0.4);
}
#if WIVRN_SHOW_IMGUI_DEMO_WINDOW
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
#endif
image_index = swapchain.acquire();
swapchain.wait();
}
+5
View File
@@ -20,6 +20,7 @@
#include "xr/hand_tracker.h"
#include "xr/swapchain.h"
#include "wivrn_config.h"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <imgui.h>
@@ -135,6 +136,10 @@ private:
ImVector<ImWchar> glyph_ranges;
bool glyph_range_dirty = true;
#if WIVRN_SHOW_IMGUI_DEMO_WINDOW
bool show_demo_window = true;
#endif
void initialize_fonts();
public:
+2
View File
@@ -32,4 +32,6 @@
#cmakedefine01 WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
#cmakedefine01 WIVRN_FEATURE_SOLARXR
#cmakedefine01 WIVRN_SHOW_IMGUI_DEMO_WINDOW
#define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"