feat: add scene view fly controls
This commit is contained in:
@@ -263,15 +263,29 @@ void SceneViewPanel::Render() {
|
||||
|
||||
SceneViewportInput input = {};
|
||||
input.viewportSize = content.availableSize;
|
||||
input.deltaTime = io.DeltaTime;
|
||||
input.hovered = content.hovered;
|
||||
input.focused = content.focused;
|
||||
input.mouseWheel = content.hovered ? io.MouseWheel : 0.0f;
|
||||
input.mouseWheel = content.hovered ? -io.MouseWheel : 0.0f;
|
||||
input.looking = m_lookDragging;
|
||||
input.orbiting = m_orbitDragging;
|
||||
input.panning = m_panDragging;
|
||||
input.fastMove = io.KeyShift;
|
||||
input.focusSelectionRequested =
|
||||
content.focused && !io.WantTextInput && ImGui::IsKeyPressed(ImGuiKey_F, false);
|
||||
|
||||
if (m_lookDragging && content.focused && !io.WantTextInput) {
|
||||
input.moveForward =
|
||||
(ImGui::IsKeyDown(ImGuiKey_W) ? 1.0f : 0.0f) -
|
||||
(ImGui::IsKeyDown(ImGuiKey_S) ? 1.0f : 0.0f);
|
||||
input.moveRight =
|
||||
(ImGui::IsKeyDown(ImGuiKey_D) ? 1.0f : 0.0f) -
|
||||
(ImGui::IsKeyDown(ImGuiKey_A) ? 1.0f : 0.0f);
|
||||
input.moveUp =
|
||||
(ImGui::IsKeyDown(ImGuiKey_E) ? 1.0f : 0.0f) -
|
||||
(ImGui::IsKeyDown(ImGuiKey_Q) ? 1.0f : 0.0f);
|
||||
}
|
||||
|
||||
if (m_lookDragging || m_orbitDragging || m_panDragging) {
|
||||
input.mouseDelta = io.MouseDelta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user