Summary:
- Additional getters/setters - Passing setters' value as by reference - Changed includes order - Moved callback function to MovingCubeApp - Made Event public
This commit is contained in:
@@ -12,26 +12,38 @@
|
||||
#include "Math/Pose.hpp"
|
||||
#include "Scene/Node.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
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;
|
||||
double m_duration = 0;
|
||||
double 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; }
|
||||
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 OnAnimationCompleted();
|
||||
void Tick() override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user