SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLAnimManager.h
Go to the documentation of this file.
1 /**
2  * \file SLAnimManager.h
3  * \date Autumn 2014
4 // Codestyle: https://code.google.com/p/slproject/wiki/CodingStyleGuidelines
5  * \authors Marc Wacker, Marcus Hudritsch
6  * \copyright http://opensource.org/licenses/GPL-3.0
7 */
8 
9 #ifndef SLANIMMANAGER_H
10 #define SLANIMMANAGER_H
11 
12 #include <SLAnimPlayback.h>
13 #include <SLAnimation.h>
14 #include <SLAnimSkeleton.h>
15 
16 //-----------------------------------------------------------------------------
17 //! SLAnimManager is the central class for all animation handling.
18 /*!
19 A single instance of this class is hold by the SLScene instance and is
20 responsible for updating the enabled animations and to manage their life time.
21 If keeps a list of all skeletons and node animations and also holds a list of
22 all animation playback controllers.
23 The update of all animations is done before the rendering of all SLSceneView in
24 SLScene::updateIfAllViewsGotPainted by calling the SLAnimManager::update.
25 */
27 {
28 public:
30 
31  void addSkeleton(SLAnimSkeleton* skel);
35  SLfloat duration);
37  SLfloat duration,
38  SLbool enabled,
39  SLEasingCurve easing,
40  SLAnimLooping looping);
41  SLbool hasNodeAnimations() { return (_animationNamesMap.size() > 0); }
42 
51 
52  SLbool update(SLfloat elapsedTimeSec);
53  void drawVisuals(SLSceneView* sv);
54  void clear();
55 
56 private:
57  SLVSkeleton _skeletons; //!< all skeleton instances
58  SLMAnimation _animationNamesMap; //!< map name to animation
59  SLMAnimPlayback _animPlaybackNamesMap; //!< map name to animation playbacks
60  SLVstring _animationNames; //!< vector with all animation names
61  SLVAnimPlayback _animPlaybacks; //!< vector with all animation playbacks
62 };
63 //-----------------------------------------------------------------------------
64 #endif
float SLfloat
Definition: SL.h:173
unsigned int SLuint
Definition: SL.h:171
bool SLbool
Definition: SL.h:175
vector< SLstring > SLVstring
Definition: SL.h:201
string SLstring
Definition: SL.h:158
vector< SLAnimPlayback * > SLVAnimPlayback
std::map< SLstring, SLAnimPlayback * > SLMAnimPlayback
vector< SLAnimSkeleton * > SLVSkeleton
std::map< SLstring, SLAnimation * > SLMAnimation
Definition: SLAnimation.h:85
SLEasingCurve
Enumeration for animation easing curves.
Definition: SLEnums.h:180
SLAnimLooping
Enumeration for animation modes.
Definition: SLEnums.h:167
SLAnimManager is the central class for all animation handling.
Definition: SLAnimManager.h:27
SLVAnimPlayback & animPlaybacks()
Definition: SLAnimManager.h:47
SLVSkeleton _skeletons
all skeleton instances
Definition: SLAnimManager.h:57
SLMAnimation & animationNamesMap()
Definition: SLAnimManager.h:44
SLVSkeleton & skeletons()
Definition: SLAnimManager.h:43
SLAnimPlayback * animPlaybackByName(const SLstring &name)
Returns the playback of a node animation or skeleton by name if it exists.
SLMAnimPlayback & animPlaybackNamesMap()
Definition: SLAnimManager.h:45
~SLAnimManager()
destructor
SLMAnimation _animationNamesMap
map name to animation
Definition: SLAnimManager.h:58
SLVstring & animationNames()
Definition: SLAnimManager.h:46
void addNodeAnimation(SLAnimation *anim)
SLAnimation * createNodeAnimation(SLfloat duration)
void addSkeleton(SLAnimSkeleton *skel)
Add a skeleton to the skeleton vector.
void clear()
Clears and deletes all node animations and skeletons.
SLVstring _animationNames
vector with all animation names
Definition: SLAnimManager.h:60
SLMAnimPlayback _animPlaybackNamesMap
map name to animation playbacks
Definition: SLAnimManager.h:59
SLbool hasNodeAnimations()
Definition: SLAnimManager.h:41
SLVAnimPlayback _animPlaybacks
vector with all animation playbacks
Definition: SLAnimManager.h:61
SLAnimPlayback * animPlaybackByIndex(SLuint ix)
Definition: SLAnimManager.h:49
SLAnimPlayback * animPlaybacksBack()
Definition: SLAnimManager.h:50
void drawVisuals(SLSceneView *sv)
Draws the animation visualizations.
SLbool update(SLfloat elapsedTimeSec)
Advances the time of all enabled animation plays.
Manages the playback of an SLAnimation.
SLAnimSkeleton keeps track of a skeletons joints and animations.
SLAnimation is the base container for all animation data.
Definition: SLAnimation.h:33
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69