feat: add scene view fly controls

This commit is contained in:
2026-03-28 18:28:11 +08:00
parent af2f30dad6
commit 569f8ef725
5 changed files with 72 additions and 2 deletions

View File

@@ -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;
}