Files
OpenVulkano/openVulkanoCpp/Scene/SimpleAnimationController.hpp
2024-06-05 22:05:40 +03:00

37 lines
1.1 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"
namespace OpenVulkano::Scene
{
class SimpleAnimationController : public ITickable
{
OpenVulkano::Scene::Node *m_node = nullptr;
OpenVulkano::Event<> m_event;
OpenVulkano::Math::Pose<float> m_targetPose;
OpenVulkano::Math::Pose<float> 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<float> pose) { m_initialPose = pose; }
void SetTargetPose(OpenVulkano::Math::Pose<float> pose) { m_targetPose = pose; }
void SetDuration(float duration) { m_duration = duration; }
void OnAnimationCompleted();
void Tick() override;
};
}