Fixed Right click camera being buggy for some reason?
This commit is contained in:
@@ -94,7 +94,13 @@ glm::mat4 Camera::getViewMatrix() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ViewportController implementation
|
// ViewportController implementation
|
||||||
void ViewportController::updateFocusFromImGui(bool windowFocused) {
|
void ViewportController::updateFocusFromImGui(bool windowFocused, bool cursorLocked) {
|
||||||
|
if (cursorLocked) {
|
||||||
|
viewportFocused = true;
|
||||||
|
manualUnfocus = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!windowFocused && viewportFocused && !manualUnfocus) {
|
if (!windowFocused && viewportFocused && !manualUnfocus) {
|
||||||
viewportFocused = false;
|
viewportFocused = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ private:
|
|||||||
bool manualUnfocus = false;
|
bool manualUnfocus = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void updateFocusFromImGui(bool windowFocused);
|
void updateFocusFromImGui(bool windowFocused, bool cursorLocked);
|
||||||
void setFocused(bool focused);
|
void setFocused(bool focused);
|
||||||
bool isViewportFocused() const;
|
bool isViewportFocused() const;
|
||||||
void clearManualUnfocus();
|
void clearManualUnfocus();
|
||||||
|
|||||||
@@ -2162,6 +2162,9 @@ void Engine::renderViewport() {
|
|||||||
glfwSetInputMode(editorWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(editorWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
camera.firstMouse = true;
|
camera.firstMouse = true;
|
||||||
}
|
}
|
||||||
|
if (cursorLocked) {
|
||||||
|
viewportController.setFocused(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlay hint
|
// Overlay hint
|
||||||
@@ -2180,7 +2183,7 @@ void Engine::renderViewport() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool windowFocused = ImGui::IsWindowFocused();
|
bool windowFocused = ImGui::IsWindowFocused();
|
||||||
viewportController.updateFocusFromImGui(windowFocused);
|
viewportController.updateFocusFromImGui(windowFocused, cursorLocked);
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user