Update MorphableCameraController

This commit is contained in:
Georg Hagen
2025-01-26 19:30:36 +01:00
parent 843aebeafa
commit e9b419cd3c
4 changed files with 53 additions and 25 deletions

View File

@@ -3,6 +3,7 @@
* 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"
@@ -24,9 +25,6 @@ namespace OpenVulkano
bool m_isMorphing;
bool m_targetMorphStatePerspective; // true for perspective, false for orthographic
Input::InputAction* m_actionMorph;
bool m_wasMorphingKeyDown = false;
public:
MorphableCameraController(MorphableCamera* camera = nullptr);
@@ -34,12 +32,39 @@ namespace OpenVulkano
#pragma clang diagnostic ignored "-Woverloaded-virtual"
void Init(MorphableCamera* camera);
#pragma clang diagnostic pop
void Tick() override;
void SetDuration(const double duration) { m_animationDuration = duration; }
[[nodiscard]] double GetDuration() const { return m_animationDuration; }
void SetTargetState(bool toPerspective);
[[nodiscard]] bool IsTargetPerspective() const { return m_targetMorphStatePerspective; }
void Reset() { m_currentTime = 0; }
};
class MorphableCameraControllerWithInput final
{
MorphableCameraController m_controller;
Input::InputAction* m_actionMorph;
public:
MorphableCameraControllerWithInput(MorphableCamera* camera = nullptr);
void Init(MorphableCamera* camera) { m_controller.Init(camera); }
void Tick();
void SetDuration(const double duration) { m_controller.SetDuration(duration); }
[[nodiscard]] double GetDuration() const { return m_controller.GetDuration(); }
void SetTargetState(const bool toPerspective) { m_controller.SetTargetState(toPerspective); }
void Reset() { m_controller.Reset(); }
};
}
}