AnimationT.hh 1.57 KB
Newer Older
Dirk Wilden's avatar
Dirk Wilden committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef ANIMATIONT_HH
#define ANIMATIONT_HH

#include <vector>
#include <map>

#include "../PoseT.hh"
#include "AnimationHandle.hh"

/**
 * @brief Stores a single animation
 *
 * This class is used by a skeleton to store a single animation. An animation is an array of different Poses.
 * Both the reference pose and the skeleton hierarchy are not used by the animation class itself, but are
 * passed to the poses.
 */
template<typename PointT>
class AnimationT
{
  template<typename>
  friend class SkeletonT;

public:
  typedef PointT                                Point;
  typedef typename Point::value_type            Scalar;
  typedef PoseT<PointT>                         Pose;

public:
  AnimationT(std::string _name = "") : name_(_name), fps_(60) {}
  virtual AnimationT* copy() = 0;

public:
  /**
    * @name Frame access
    * There is one pose per frame.
    */
  //@{
  virtual Pose *pose(unsigned int _iFrame) = 0;
  virtual unsigned int frameCount() = 0;
  //@}

  /**
    * @name Synchronization
    * Use these methods to keep the poses in sync with the number (and indices) of the joints.
    */
  //@{
  virtual void insertJointAt(unsigned int _index) = 0;
  virtual void removeJointAt(unsigned int _index) = 0;
  //@}

  virtual void updateFromGlobal(unsigned int _index) = 0;
  virtual void clearPoseCache() {}

  inline std::string name() {
    return name_;
  }

  inline void setName(std::string _name) {
    name_ = _name;
  }

  inline int fps() {
    return fps_;
  }

  inline void setFps(int _fps) {
    fps_ = _fps;
  }

protected:
  std::string name_;
  int fps_;
};


#endif