Files
OpenVulkano/openVulkanoCpp/Scene/SimpleAnimationController.hpp
Vladyslav Baranovskyi 193c942f06 Summary:
- Additional getters/setters
- Passing setters' value as by reference
- Changed includes order
- Moved callback function to MovingCubeApp
- Made Event public
2024-06-06 13:21:02 +03:00

49 lines
1.5 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 "Base/ITickable.hpp"
#include "Base/Event.hpp"
#include "Math/Math.hpp"
#include "Math/Pose.hpp"
#include "Scene/Node.hpp"
#include <utility>
namespace OpenVulkano::Scene
{
class SimpleAnimationController : public ITickable
{
OpenVulkano::Scene::Node *m_node = nullptr;
OpenVulkano::Math::Pose<float> m_targetPose;
OpenVulkano::Math::Pose<float> m_initialPose;
double m_duration = 0;
double m_elapsed = 0;
public:
OpenVulkano::Event<SimpleAnimationController *> m_completionEvent;
SimpleAnimationController() = default;
void Reset() { m_elapsed = 0; }
void SwapPoses() { std::swap(m_initialPose, m_targetPose); }
OpenVulkano::Scene::Node* GetNode() { return m_node; }
void SetNode(OpenVulkano::Scene::Node *node) { m_node = node; }
OpenVulkano::Math::Pose<float> GetInitialPose() { return m_initialPose; }
OpenVulkano::Math::Pose<float> GetTargetPose() { return m_targetPose; }
void SetPoses(const OpenVulkano::Math::Pose<float> &initialPose, const OpenVulkano::Math::Pose<float> &targetPose) { m_initialPose = initialPose; m_targetPose = targetPose; }
double GetDuration() { return m_duration; }
void SetDuration(double duration) { m_duration = duration; }
double GetProgress();
void Tick() override;
};
}