You.i Engine
YiTimelineKeyTime.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_TIMELINE_KEY_TIME_H_
3 #define _YI_TIMELINE_KEY_TIME_H_
4 
6 #include "animation/YiVariant.h"
7 #include "framework/YiPredef.h"
8 
20 {
21 public:
25  enum class InterpolationType : uint8_t
26  {
27  Linear,
28  Bezier,
29  Hold
30  };
31 
35  struct EASE
36  {
37  float speedIn;
38  float influenceIn;
39  float speedOut;
40  float influenceOut;
41  };
42 
48  struct SPATIAL_EASE
49  {
50  float x;
51  float y;
52  float z;
53  };
54 
59  {
60  KEYTIME_SETUP();
61 
71  uint32_t time;
83  std::vector<EASE> easeValues;
92  };
93 
97  static const uint32_t MAX_EASE_DIMENSIONS = 3;
98 
102 
104 
108  void CalculateValue(const CYITimelineKeyTime *pPrevious, float dataPositions[MAX_EASE_DIMENSIONS], uint32_t dimensionCount, CYIVariant &rOutValue) const;
109 
115  void ClearInterpolators();
116 
122  uint32_t GetDuration() const;
126  void SetDuration(uint32_t duration);
127 
133  uint32_t GetAbsoluteTime() const;
137  void SetAbsoluteTime(uint32_t absoluteTime);
138 
144  const EASE *GetEase(size_t dimensionIndex) const;
150  size_t GetEaseDimensionCount() const;
163  const CYIVariant &GetKeyValue() const;
164 
172  float GetKeyValueAsFloat(size_t dimensionIndex) const;
173 
179  const SPATIAL_EASE *GetSpatialEaseIn() const;
185  const SPATIAL_EASE *GetSpatialEaseOut() const;
191  CYITimeInterpolator *GetTimeInterpolator(size_t valueIndex);
192 
196  void InitKeyTime(CYITimelineKeyTime::KEYTIME_SETUP &&keytimeSetup);
197 
203  void InitKeyTime(const CYITimelineKeyTime::KEYTIME_SETUP *pKeytimeSetup);
204 
208  void SetSpatialInterpolator(float c0, float c1, float c2, float c3, size_t dimensionIndex);
212  void SetTimeInterpolator(std::unique_ptr<CYITimeInterpolator> pInterpolator, size_t dimensionIndex);
213 
218 
222  size_t GetApproximateSize() const;
223 
224 private:
225  struct BezierData;
226 
227  CYITimelineKeyTime(const CYITimelineKeyTime &) = delete;
228  const CYITimelineKeyTime &operator=(const CYITimelineKeyTime &) = delete;
229 
230  void EnsureBezierDataObjectExists();
231 
232  CYIVariant m_keyValue;
233  uint32_t m_duration;
234  uint32_t m_absoluteTime;
235  CYITimelineKeyTime::InterpolationType m_interpolationType;
236 
237  std::unique_ptr<BezierData> m_pBezierData;
238 };
239 
244 #endif // _YI_TIMELINE_KEY_TIME_H_
uint32_t GetAbsoluteTime() const
float influenceOut
Definition: YiTimelineKeyTime.h:40
Container for basic interpolator functions.
Definition: YiTimeInterpolator.h:20
A container class for common data types.
Definition: YiVariant.h:33
void InitKeyTime(CYITimelineKeyTime::KEYTIME_SETUP &&keytimeSetup)
Definition: YiTimelineKeyTime.h:35
void SetSpatialInterpolator(float c0, float c1, float c2, float c3, size_t dimensionIndex)
void DumpSpatialInterpolatorData()
Definition: YiTimelineKeyTime.h:58
Definition: YiTimelineKeyTime.h:48
An individual point in a CYITimelineTrack which represents a CYISceneNode property value for a specif...
Definition: YiTimelineKeyTime.h:19
static const uint32_t MAX_EASE_DIMENSIONS
Definition: YiTimelineKeyTime.h:97
void SetAbsoluteTime(uint32_t absoluteTime)
float y
Definition: YiTimelineKeyTime.h:51
CYIVariant value
Definition: YiTimelineKeyTime.h:75
float x
Definition: YiTimelineKeyTime.h:50
CYITimelineKeyTime & operator=(CYITimelineKeyTime &&)
InterpolationType
Definition: YiTimelineKeyTime.h:25
const CYIVariant & GetKeyValue() const
SPATIAL_EASE spatialEaseIn
Definition: YiTimelineKeyTime.h:87
void SetDuration(uint32_t duration)
CYITimeInterpolator * GetTimeInterpolator(size_t valueIndex)
uint32_t GetDuration() const
size_t GetApproximateSize() const
InterpolationType interpolationType
Definition: YiTimelineKeyTime.h:67
float influenceIn
Definition: YiTimelineKeyTime.h:38
SPATIAL_EASE spatialEaseOut
Definition: YiTimelineKeyTime.h:91
float GetKeyValueAsFloat(size_t dimensionIndex) const
InterpolationType GetInterpolationType() const
float z
Definition: YiTimelineKeyTime.h:52
void SetTimeInterpolator(std::unique_ptr< CYITimeInterpolator > pInterpolator, size_t dimensionIndex)
uint32_t time
Definition: YiTimelineKeyTime.h:71
const SPATIAL_EASE * GetSpatialEaseOut() const
float speedIn
Definition: YiTimelineKeyTime.h:37
const EASE * GetEase(size_t dimensionIndex) const
const SPATIAL_EASE * GetSpatialEaseIn() const
size_t GetEaseDimensionCount() const
std::vector< EASE > easeValues
Definition: YiTimelineKeyTime.h:83
float speedOut
Definition: YiTimelineKeyTime.h:39
void CalculateValue(const CYITimelineKeyTime *pPrevious, float dataPositions[MAX_EASE_DIMENSIONS], uint32_t dimensionCount, CYIVariant &rOutValue) const