- In MovingCubeApp animations are now allocated on stack - m_sequenceAnimationController now uses SetAnimationPoseResetTime() - Removed OnSequenceAnimationCompleted() - Pose::GetOrientation() now returns by value(without it my code doesn't compile) - GetStep() getter - In if(m_loop) checking for m_resetTime to be zero or last step to be equal to the first - Tick now ticks only if there are at least one element in m_steps - IsFinished() function - AddAnimationSteps() functions that take initializer_lists - Getters in SimpleAnimationController are now const
49 lines
1.3 KiB
C++
49 lines
1.3 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
|
|
{
|
|
Node *m_node = nullptr;
|
|
Math::PoseF m_targetPose;
|
|
Math::PoseF m_initialPose;
|
|
double m_duration = 0;
|
|
double m_elapsed = 0;
|
|
|
|
public:
|
|
Event<SimpleAnimationController *> m_completionEvent;
|
|
|
|
SimpleAnimationController() = default;
|
|
|
|
void Reset() { m_elapsed = 0; }
|
|
void SwapPoses() { std::swap(m_initialPose, m_targetPose); }
|
|
|
|
Node* GetNode() const { return m_node; }
|
|
void SetNode(Node *node) { m_node = node; }
|
|
|
|
const Math::PoseF& GetInitialPose() const { return m_initialPose; }
|
|
const Math::PoseF& GetTargetPose() const { return m_targetPose; }
|
|
void SetPoses(const Math::PoseF &initialPose, const Math::PoseF &targetPose) { m_initialPose = initialPose; m_targetPose = targetPose; }
|
|
|
|
double GetDuration() const { return m_duration; }
|
|
void SetDuration(double duration) { m_duration = duration; }
|
|
|
|
double GetProgress();
|
|
|
|
void Tick() override;
|
|
};
|
|
} |