Radium Engine  1.5.20
Loading...
Searching...
No Matches
AnimationData.hpp
1#pragma once
2
3#include <Core/Animation/KeyFramedValue.hpp>
4#include <Core/Asset/AnimationTime.hpp>
5#include <Core/Asset/AssetData.hpp>
6#include <Core/RaCore.hpp>
7#include <Core/Utils/Log.hpp>
8
9#include <string>
10#include <vector>
11
12namespace Ra {
13namespace Core {
14namespace Asset {
15
31
37class RA_CORE_API AnimationData : public AssetData
38{
39 public:
40 explicit AnimationData( const std::string& name = "" );
41
43
47 inline void setName( const std::string& name ) { m_name = name; }
48
51
55 inline const AnimationTime& getTime() const { return m_time; }
56
60 inline void setTime( const AnimationTime& time ) { m_time = time; }
64 inline AnimationTime::Time getTimeStep() const { return m_dt; }
65
69 inline void setTimeStep( const AnimationTime::Time& delta ) { m_dt = delta; }
70
72
75
79 inline uint getFramesSize() const { return m_keyFrame.size(); }
80
84 inline std::vector<HandleAnimation> getHandleData() const { return m_keyFrame; }
85
89 inline void setHandleData( const std::vector<HandleAnimation>& frameList );
91
95 inline void displayInfo() const;
96
97 protected:
100
103
106};
107
109 const uint size = frameList.size();
110 m_keyFrame.resize( size );
111#pragma omp parallel for
112 for ( int i = 0; i < int( size ); ++i ) {
113 m_keyFrame[i] = frameList[i];
114 }
115}
116
117inline void AnimationData::displayInfo() const {
118 using namespace Core::Utils; // log
119 LOG( logDEBUG ) << "======== ANIMATION INFO ========";
120 LOG( logDEBUG ) << " Name : " << m_name;
121 LOG( logDEBUG ) << " Start Time : " << m_time.getStart();
122 LOG( logDEBUG ) << " End Time : " << m_time.getEnd();
123 LOG( logDEBUG ) << " Time Step : " << m_dt;
124 LOG( logDEBUG ) << " Animated Object # : " << m_keyFrame.size();
125}
126
127} // namespace Asset
128} // namespace Core
129} // namespace Ra
void setHandleData(const std::vector< HandleAnimation > &frameList)
AnimationTime m_time
The AnimationTime for the object.
std::vector< HandleAnimation > m_keyFrame
The animation frames.
AnimationTime::Time getTimeStep() const
AnimationTime::Time m_dt
The animation timestep.
std::vector< HandleAnimation > getHandleData() const
const AnimationTime & getTime() const
void setName(const std::string &name)
void setTimeStep(const AnimationTime::Time &delta)
void setTime(const AnimationTime &time)
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3
T size(T... args)
std::string m_name
The Handle's name.
AnimationTime m_animationTime
The AnimationTime for the Handle.
Core::Animation::KeyFramedValue< Transform > m_anim
The list of KeyFramed transforms applied to the Handle.