xoreos  0.0.5
animationchannel.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_AURORA_ANIMATIONCHANNEL_H
26 #define GRAPHICS_AURORA_ANIMATIONCHANNEL_H
27 
28 #include <list>
29 #include <vector>
30 
31 #include "src/common/mutex.h"
32 
33 namespace Graphics {
34 
35 namespace Aurora {
36 
37 class Model;
38 class ModelNode;
39 class Animation;
40 
42 public:
43  AnimationChannel(Model *model);
44 
53  void playAnimation(const Common::UString &anim,
54  bool restart = true,
55  float length = 0.0f,
56  float speed = 1.0f);
57 
64  void playAnimationCount(const Common::UString &anim,
65  bool restart = true,
66  int32 loopCount = 0);
67 
68  // .--- Default animations
69 
71  void addDefaultAnimation(const Common::UString &name, uint8 probability);
72  void playDefaultAnimation();
73 
74  // '---
75 
76  void manageAnimations(float dt);
77 private:
81  };
82 
83  typedef std::list<DefaultAnimation> DefaultAnimations;
84 
94  std::vector<ModelNode *> _modelNodeMap;
96 
99  void setCurrentAnimation(Animation *anim);
100  void makeModelNodeMap();
101 };
102 
103 } // End of namespace Aurora
104 
105 } // End of namespace Graphics
106 
107 #endif // GRAPHICS_AURORA_ANIMATIONCHANNEL_H
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Play a named animation.
float _animationLoopTime
The time the current loop of the current animation has played.
float _animationSpeed
The speed the current animation should run at.
float _animationTime
The time the current animation has played.
A class holding an UTF-8 string.
Definition: ustring.h:48
std::list< DefaultAnimation > DefaultAnimations
uint8_t uint8
Definition: types.h:200
A semaphore .
Definition: mutex.h:55
void addDefaultAnimation(const Common::UString &name, uint8 probability)
float _animationLoopLength
The length of one loop of the current animation.
float _animationLength
The time the current animation should run for.
Animation * _currentAnimation
The currently playing animation.
Thread mutex classes.
Animation * _nextAnimation
The animation that&#39;s scheduled next.
std::vector< ModelNode * > _modelNodeMap
uint8 probability
The probability (in percent) this animation is selected.
void playAnimationCount(const Common::UString &anim, bool restart=true, int32 loopCount=0)
Play a named animation a number of loop iterations.
void setCurrentAnimation(Animation *anim)
int32_t int32
Definition: types.h:203