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
|
||||
void ViewportController::updateFocusFromImGui(bool windowFocused) {
|
||||
void ViewportController::updateFocusFromImGui(bool windowFocused, bool cursorLocked) {
|
||||
if (cursorLocked) {
|
||||
viewportFocused = true;
|
||||
manualUnfocus = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!windowFocused && viewportFocused && !manualUnfocus) {
|
||||
viewportFocused = false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ private:
|
||||
bool manualUnfocus = false;
|
||||
|
||||
public:
|
||||
void updateFocusFromImGui(bool windowFocused);
|
||||
void updateFocusFromImGui(bool windowFocused, bool cursorLocked);
|
||||
void setFocused(bool focused);
|
||||
bool isViewportFocused() const;
|
||||
void clearManualUnfocus();
|
||||
|
||||
@@ -2162,6 +2162,9 @@ void Engine::renderViewport() {
|
||||
glfwSetInputMode(editorWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
camera.firstMouse = true;
|
||||
}
|
||||
if (cursorLocked) {
|
||||
viewportController.setFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Overlay hint
|
||||
@@ -2180,7 +2183,7 @@ void Engine::renderViewport() {
|
||||
}
|
||||
|
||||
bool windowFocused = ImGui::IsWindowFocused();
|
||||
viewportController.updateFocusFromImGui(windowFocused);
|
||||
viewportController.updateFocusFromImGui(windowFocused, cursorLocked);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user