50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "CameraController.hpp"
|
|
#include "Math/Math.hpp"
|
|
|
|
namespace OpenVulkano
|
|
{
|
|
namespace Input
|
|
{
|
|
class InputAction;
|
|
}
|
|
|
|
class ArcballCameraController final : public CameraController
|
|
{
|
|
Math::Vector3f_SIMD m_upVector{ 0, 1, 0 }, m_rightVector{ 1, 0, 0 };
|
|
Math::Vector4f_SIMD m_pivotPoint{ 0, 0, 0, 1 };
|
|
|
|
Input::InputAction* m_actionForward = nullptr;
|
|
Input::InputAction* m_actionSide = nullptr;
|
|
Input::InputAction* m_actionUp = nullptr;
|
|
Input::InputAction* m_actionLookUp = nullptr;
|
|
Input::InputAction* m_actionLookSide = nullptr;
|
|
|
|
void SetupInputActions();
|
|
|
|
public:
|
|
ArcballCameraController() { SetupInputActions(); }
|
|
|
|
ArcballCameraController(Scene::Camera* camera) : CameraController(camera) { SetupInputActions(); SetActive(); }
|
|
|
|
void Tick() override;
|
|
|
|
[[nodiscard]] const Math::Vector4f_SIMD& GetPivotPoint() const { return m_pivotPoint; }
|
|
|
|
void SetPivotPoint(const Math::Vector4f_SIMD& pivotPoint) { m_pivotPoint = pivotPoint; }
|
|
|
|
void SetActive();
|
|
|
|
void SetDefaultKeybindings();
|
|
|
|
void Init(Scene::Camera *camera) override { CameraController::SetCamera(camera); SetActive(); }
|
|
};
|
|
}
|