Pioneer
Animation.h
Go to the documentation of this file.
1 // Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _SCENEGRAPH_ANIMATION_H
5 #define _SCENEGRAPH_ANIMATION_H
6 /*
7  * A named animation, such as "GearDown".
8  * An animation has a number of channels, each of which
9  * animate the position/rotation of a single MatrixTransform node
10  */
11 #include "AnimationChannel.h"
12 
13 namespace SceneGraph {
14 
15  class Loader;
16  class BinaryConverter;
17  class Node;
18 
19  class Animation {
20  public:
21  Animation(const std::string &name, double duration);
22  Animation(const Animation &);
23  void UpdateChannelTargets(Node *root);
24  double GetDuration() const { return m_duration; }
25  const std::string &GetName() const { return m_name; }
26  double GetProgress();
27  void SetProgress(double); //0.0 -- 1.0, overrides m_time
28  void Interpolate(); //update transforms according to m_time;
29  const std::vector<AnimationChannel> &GetChannels() const { return m_channels; }
30 
31  private:
32  friend class Loader;
33  friend class BinaryConverter;
34  double m_duration;
35  double m_time;
36  std::string m_name;
37  std::vector<AnimationChannel> m_channels;
38  };
39 
40 } // namespace SceneGraph
41 
42 #endif
Definition: Animation.h:19
void UpdateChannelTargets(Node *root)
Definition: Animation.cpp:30
const std::string & GetName() const
Definition: Animation.h:25
Animation(const std::string &name, double duration)
Definition: Animation.cpp:13
void SetProgress(double)
Definition: Animation.cpp:130
void Interpolate()
Definition: Animation.cpp:40
const std::vector< AnimationChannel > & GetChannels() const
Definition: Animation.h:29
double GetDuration() const
Definition: Animation.h:24
double GetProgress()
Definition: Animation.cpp:125
Definition: BinaryConverter.h:43
Definition: Loader.h:32
Definition: Node.h:72
Definition: CityOnPlanet.h:31