/* * 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/SimpleAnimationController.hpp" #include "Base/Event.hpp" #include "Base/ITickable.hpp" #include "Math/Math.hpp" #include "Math/Pose.hpp" #include #include namespace OpenVulkano::Scene { class SequenceAnimationController : public SimpleAnimationController { using PoseDurationPair = std::pair; std::vector m_steps; int m_currentStep = 0; bool m_loop = false; void AdvanceToNextStep(); public: SequenceAnimationController(); Event m_sequenceCompletionEvent; void EnableLoop(bool value) { m_loop = value; } void Restart(); void AddAnimationStep(const Math::PoseF &pose, double duration); bool IsFinished() { if(m_loop) return false; return m_currentStep >= m_steps.size(); } void OnCurrentFrameFinished(SimpleAnimationController *animationController); void Tick() override; }; }