Beta implementation of FrameBuffer projection change for cropping.

This commit is contained in:
brunoherbelin
2020-11-22 21:58:04 +01:00
parent 61ee23455b
commit c33796e97c
8 changed files with 122 additions and 125 deletions

View File

@@ -395,8 +395,13 @@ void ImGuiVisitor::visit (Source& s)
// preview
float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
ImVec2 imagesize ( preview_width, preview_width / s.frame()->aspectRatio());
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), imagesize);
float width = preview_width;
float height = width / ( s.frame()->aspectRatio() * s.frame()->projectionAspectRatio() );
if (height > 200) {
height = 200;
width = height * ( s.frame()->aspectRatio() * s.frame()->projectionAspectRatio() );
}
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height));
ImVec2 pos = ImGui::GetCursorPos(); // remember where we were...