diff --git a/imgui.ini b/imgui.ini index 060446d..5d31e30 100644 --- a/imgui.ini +++ b/imgui.ini @@ -4,8 +4,8 @@ Size=400,400 Collapsed=0 [Window][Terrain Controls] -Pos=877,19 -Size=403,701 +Pos=936,19 +Size=344,654 Collapsed=0 DockId=0x00000002,0 @@ -19,17 +19,17 @@ Collapsed=0 [Window][TerraVisor] Pos=0,0 -Size=1280,720 +Size=1280,673 Collapsed=0 [Window][Scene Window] Pos=0,19 -Size=875,701 +Size=934,654 Collapsed=0 DockId=0x00000001,0 [Docking][Data] -DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,19 Size=1280,701 Split=X Selected=0x9F2D9299 - DockNode ID=0x00000001 Parent=0x6F42A598 SizeRef=875,701 CentralNode=1 Selected=0x9F2D9299 - DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=403,701 Selected=0xF69494A7 +DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,19 Size=1280,654 Split=X Selected=0x9F2D9299 + DockNode ID=0x00000001 Parent=0x6F42A598 SizeRef=934,701 CentralNode=1 Selected=0x9F2D9299 + DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=344,701 Selected=0xF69494A7 diff --git a/source/scene.cpp b/source/scene.cpp index ef0db75..0039f12 100644 --- a/source/scene.cpp +++ b/source/scene.cpp @@ -342,7 +342,9 @@ void Scene::DrawGui(GLFWwindow* window) { // Draw FBO to ImGui window ImGui::Begin("Scene Window"); ImVec2 windowSize = ImGui::GetContentRegionAvail(); - ImGui::Image((void*)(intptr_t)lht_fbo_.albedoTexture, windowSize, ImVec2(0, 1), ImVec2(1, 0)); + window_width = ImGui::GetWindowSize().x; + window_height = ImGui::GetWindowSize().y; + ImGui::Image((void*)(intptr_t)lht_fbo_.albedoTexture, ImVec2(window_width, window_height), ImVec2(0, 1), ImVec2(1, 0)); ImGui::End(); ImGui::Render(); @@ -383,7 +385,7 @@ std::vector Scene::LoadHGT(const std::string& filename, int width, int } void Scene::UpdateCamera() { - projection_matrix_ = glm::perspective(CameraControls::GetFOV(activeCamera_), aspect_, activeCamera_.nearPlane, activeCamera_.farPlane); + projection_matrix_ = glm::perspective(CameraControls::GetFOV(activeCamera_), static_cast(window_width) / window_height, activeCamera_.nearPlane, activeCamera_.farPlane); } GLuint Scene::CreateHeightmapTexture(std::vector data, int width, int height) {