52 lines
1.3 KiB
C++
52 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 FreeCamCameraController final : public CameraController
|
|
{
|
|
float m_yaw = 0, m_pitch = 0, m_boostFactor = 1.5;
|
|
Math::Vector3f_SIMD m_position = { 0, 0, 0 };
|
|
|
|
Input::InputAction* m_actionForward;
|
|
Input::InputAction* m_actionSide;
|
|
Input::InputAction* m_actionUp;
|
|
Input::InputAction* m_actionLookUp;
|
|
Input::InputAction* m_actionLookSide;
|
|
Input::InputAction* m_actionBoost;
|
|
|
|
public:
|
|
FreeCamCameraController(Scene::Camera* camera = nullptr);
|
|
|
|
~FreeCamCameraController() override = default;
|
|
|
|
void Init(Scene::Camera* camera) override { CameraController::Init(camera); ResetPose(); }
|
|
|
|
void ResetPose() { m_yaw = m_pitch = 0; m_position = { 0, 0, 0 }; }
|
|
|
|
void SetPosition(const Math::Vector3f_SIMD& position) { m_position = position; }
|
|
|
|
void SetOrientation(float yaw, float pitch) { m_yaw = yaw; m_pitch = pitch; }
|
|
|
|
void SetBoostFactor(float factor = 2) { m_boostFactor = factor; }
|
|
|
|
void Tick() override;
|
|
|
|
void SetDefaultKeybindings();
|
|
|
|
void SetActive() override;
|
|
};
|
|
} |