Resize viewport keeps propper aspect
TODO keep correct aspect when resizing main window
This commit is contained in:
parent
4f17647387
commit
eb1e2a0ba8
14
imgui.ini
14
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
|
||||
|
||||
|
|
|
@ -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<int16_t> 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<float>(window_width) / window_height, activeCamera_.nearPlane, activeCamera_.farPlane);
|
||||
}
|
||||
|
||||
GLuint Scene::CreateHeightmapTexture(std::vector<int16_t> data, int width, int height) {
|
||||
|
|
Loading…
Reference in New Issue