add mirror option to debug video tap

This commit is contained in:
Green Sky 2024-09-19 10:42:29 +02:00
parent 697611ff55
commit 8cdf2a2ca3
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -160,13 +160,19 @@ float DebugVideoTap::render(void) {
ImGui::EndCombo(); ImGui::EndCombo();
} }
//ImGui::SetNextItemWidth(0);
ImGui::Checkbox("mirror", &_mirror);
// img here // img here
if (_tex != 0) { if (_tex != 0) {
ImGui::SameLine();
ImGui::Text("moving avg interval: %f", _v_interval_avg); ImGui::Text("moving avg interval: %f", _v_interval_avg);
const float img_w = ImGui::GetContentRegionAvail().x; const float img_w = ImGui::GetContentRegionAvail().x;
ImGui::Image( ImGui::Image(
reinterpret_cast<ImTextureID>(_tex), reinterpret_cast<ImTextureID>(_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}
); );
} }
} }

View File

@ -18,6 +18,8 @@ class DebugVideoTap {
uint32_t _tex_w {0}; uint32_t _tex_w {0};
uint32_t _tex_h {0}; uint32_t _tex_h {0};
bool _mirror {false}; // flip horizontally
uint64_t _v_last_ts {0}; // us uint64_t _v_last_ts {0}; // us
float _v_interval_avg {0.f}; // s float _v_interval_avg {0.f}; // s