Add check for viewport size change to update camera

This commit is contained in:
Jack 2024-08-26 10:58:22 -04:00
parent eb1e2a0ba8
commit eff5bb09e9
1 changed files with 5 additions and 2 deletions

View File

@ -342,8 +342,11 @@ void Scene::DrawGui(GLFWwindow* window) {
// Draw FBO to ImGui window
ImGui::Begin("Scene Window");
ImVec2 windowSize = ImGui::GetContentRegionAvail();
window_width = ImGui::GetWindowSize().x;
window_height = ImGui::GetWindowSize().y;
if (ImGui::GetWindowSize().x != window_width || ImGui::GetWindowSize().y != window_height) {
window_width = ImGui::GetWindowSize().x;
window_height = ImGui::GetWindowSize().y;
UpdateCamera();
}
ImGui::Image((void*)(intptr_t)lht_fbo_.albedoTexture, ImVec2(window_width, window_height), ImVec2(0, 1), ImVec2(1, 0));
ImGui::End();