From 8cdf2a2ca3e7df686087717e06631a0e332858b4 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 19 Sep 2024 10:42:29 +0200 Subject: [PATCH] add mirror option to debug video tap --- src/debug_video_tap.cpp | 8 +++++++- src/debug_video_tap.hpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/debug_video_tap.cpp b/src/debug_video_tap.cpp index c18574d..698c3fc 100644 --- a/src/debug_video_tap.cpp +++ b/src/debug_video_tap.cpp @@ -160,13 +160,19 @@ float DebugVideoTap::render(void) { ImGui::EndCombo(); } + //ImGui::SetNextItemWidth(0); + ImGui::Checkbox("mirror", &_mirror); + // img here if (_tex != 0) { + ImGui::SameLine(); ImGui::Text("moving avg interval: %f", _v_interval_avg); const float img_w = ImGui::GetContentRegionAvail().x; ImGui::Image( reinterpret_cast(_tex), - ImVec2{img_w, img_w * float(_tex_h)/_tex_w} + ImVec2{img_w, img_w * float(_tex_h)/_tex_w}, + ImVec2{_mirror?1.f:0.f, 0}, + ImVec2{_mirror?0.f:1.f, 1} ); } } diff --git a/src/debug_video_tap.hpp b/src/debug_video_tap.hpp index 6044ca9..528dc98 100644 --- a/src/debug_video_tap.hpp +++ b/src/debug_video_tap.hpp @@ -18,6 +18,8 @@ class DebugVideoTap { uint32_t _tex_w {0}; uint32_t _tex_h {0}; + bool _mirror {false}; // flip horizontally + uint64_t _v_last_ts {0}; // us float _v_interval_avg {0.f}; // s