/* * 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 "Base/ITickable.hpp" #include "Base/Event.hpp" #include "Math/Math.hpp" #include "Math/Pose.hpp" #include "Scene/Node.hpp" namespace OpenVulkano::Scene { class SimpleAnimationController : public ITickable { OpenVulkano::Scene::Node *m_node = nullptr; OpenVulkano::Event<> m_event; OpenVulkano::Math::Pose m_targetPose; OpenVulkano::Math::Pose m_initialPose; float m_duration = 0; float m_elapsed = 0; public: SimpleAnimationController() { m_event += EventHandler(this, &SimpleAnimationController::OnAnimationCompleted); } void SetNode(OpenVulkano::Scene::Node *node) { m_node = node; } void SetInitialPose(OpenVulkano::Math::Pose pose) { m_initialPose = pose; } void SetTargetPose(OpenVulkano::Math::Pose pose) { m_targetPose = pose; } void SetDuration(float duration) { m_duration = duration; } void OnAnimationCompleted(); void Tick() override; }; }