Loading [MathJax]/jax/output/HTML-CSS/config.js
Radium Engine  1.5.28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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/CoreMacros.hpp>
7#include <Core/RaCore.hpp>
8#include <Core/Types.hpp>
9#include <Core/Utils/Log.hpp>
10#include <algorithm>
11#include <memory>
12#include <ostream>
13#include <string>
14#include <vector>
15
16namespace Ra {
17namespace Core {
18namespace Asset {
19
35
41class RA_CORE_API AnimationData : public AssetData
42{
43 public:
44 explicit AnimationData( const std::string& name = "" );
45
47
51 inline void setName( const std::string& name ) { m_name = name; }
52
55
59 inline const AnimationTime& getTime() const { return m_time; }
60
64 inline void setTime( const AnimationTime& time ) { m_time = time; }
68 inline AnimationTime::Time getTimeStep() const { return m_dt; }
69
73 inline void setTimeStep( const AnimationTime::Time& delta ) { m_dt = delta; }
74
76
79
83 inline uint getFramesSize() const { return m_keyFrame.size(); }
84
88 inline std::vector<HandleAnimation> getHandleData() const { return m_keyFrame; }
89
93 inline void setHandleData( const std::vector<HandleAnimation>& frameList );
95
99 inline void displayInfo() const;
100
101 protected:
104
107
110};
111
113 const uint size = frameList.size();
114 m_keyFrame.resize( size );
115#pragma omp parallel for
116 for ( int i = 0; i < int( size ); ++i ) {
117 m_keyFrame[i] = frameList[i];
118 }
119}
120
121inline void AnimationData::displayInfo() const {
122 using namespace Core::Utils; // log
123 LOG( logDEBUG ) << "======== ANIMATION INFO ========";
124 LOG( logDEBUG ) << " Name : " << m_name;
125 LOG( logDEBUG ) << " Start Time : " << m_time.getStart();
126 LOG( logDEBUG ) << " End Time : " << m_time.getEnd();
127 LOG( logDEBUG ) << " Time Step : " << m_dt;
128 LOG( logDEBUG ) << " Animated Object # : " << m_keyFrame.size();
129}
130
131} // namespace Asset
132} // namespace Core
133} // 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:4
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.