Move some controllers

This commit is contained in:
Georg Hagen
2025-07-10 22:55:11 +02:00
parent fb21c4c059
commit 94d5374926
7 changed files with 8 additions and 10 deletions

View File

@@ -0,0 +1,70 @@
/*
* 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 "Scene/MorphableCamera.hpp"
#include "CameraController.hpp"
namespace OpenVulkano
{
namespace Input
{
class InputAction;
}
namespace Scene
{
class MorphableCameraController final : public CameraController
{
double m_animationDuration;
double m_currentTime;
bool m_isMorphing;
bool m_targetMorphStatePerspective; // true for perspective, false for orthographic
public:
MorphableCameraController(MorphableCamera* camera = nullptr);
#pragma clang diagnostic push
#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(); }
};
}
}