Files
OpenVulkano/openVulkanoCpp/Scene/MorphableCameraController.hpp
2024-06-25 22:05:34 +03:00

46 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 "MorphableCamera.hpp"
#include "Controller/CameraController.hpp"
#include "Input/InputManager.hpp"
#include "Input/InputKey.hpp"
#include "Math/Math.hpp"
namespace OpenVulkano::Scene
{
class MorphableCameraController final : public CameraController
{
double m_animationDuration;
double m_currentTime;
bool m_isMorphing;
bool m_targetMorphState; // true for perspective, false for orthographic
float m_yaw = 0, m_pitch = 0, m_boostFactor = 2;
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;
Input::InputAction* m_actionMorph;
bool m_wasMorphingKeyDown = false;
public:
MorphableCameraController(MorphableCamera* camera = nullptr);
void Init(MorphableCamera* camera);
void Tick() override;
void SetDefaultKeybindings();
void SetDuration(double duration) { m_animationDuration = duration; }
double GetDuration() { return m_animationDuration; }
void Reset() { m_currentTime = 0; }
};
}