Atoms Crowd  4.1.0
AnimationClips.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 #include <Atoms/AnimationClip.h>
12 #include <map>
13 #include <vector>
14 #include <functional>
15 #include <mutex>
16 
17 namespace Atoms
18 {
20 
22  class ATOMS_EXPORT AnimationClips
23  {
24  public:
25 
28 
30 
34  AnimationClipCPtr animationClip(const std::string& name) const;
35 
37 
41  AnimationClipPtr animationClip(const std::string& name);
42 
44 
48  AnimationClipPtr addAnimationClip(const std::string& name, const std::string& filePath, bool replace = true);
49 
51 
55  AnimationClipPtr addAnimationClip(const std::string& name, AnimationClipPtr& clipPtr, bool replace = true);
56 
58 
61  void removeAnimationClip(const std::string& name);
62 
64 
67  std::vector<std::string> animationClipNames();
68 
70 
74  bool animationClipExists(const std::string& name);
75 
77  unsigned int numAnimationClips();
78 
80  void clear();
81 
82  void registerLoaderCallback(std::function<AnimationClipPtr(const char*)>& callback);
83 
84  private:
85 
88 
91 
93  ~AnimationClips();
94 
96  AnimationClips& operator=(const AnimationClips&);
97 
98  typedef std::map<std::string, AnimationClipPtr> AnimationClipsMap;
99 
101 
104  AnimationClipsMap m_animationClipsMap;
105 
106  std::function<AnimationClipPtr(const char*)> m_loaderCallback;
107 
108  mutable std::mutex m_mutex;
109  };
110 }
Atoms::AnimationClips::clear
void clear()
Remove all animation clips.
Atoms::AnimationClips::animationClip
AnimationClipPtr animationClip(const std::string &name)
Return an animation clips.
Atoms::AnimationClips::animationClip
AnimationClipCPtr animationClip(const std::string &name) const
Return an animation clips.
Atoms::AnimationClips::removeAnimationClip
void removeAnimationClip(const std::string &name)
Remove an animation clip from the map.
Atoms::AnimationClips::addAnimationClip
AnimationClipPtr addAnimationClip(const std::string &name, const std::string &filePath, bool replace=true)
Add an animation clip to the map.
Atoms::AnimationClips::animationClipNames
std::vector< std::string > animationClipNames()
Get all animation clip names.
Atoms::AnimationClips
Animation clips manager.
Definition: AnimationClips.h:23
Atoms::AnimationClips::addAnimationClip
AnimationClipPtr addAnimationClip(const std::string &name, AnimationClipPtr &clipPtr, bool replace=true)
Add an animation clip to the map.
Atoms::AnimationClipCPtr
AtomsPtr< const AnimationClip > AnimationClipCPtr
animation clip const pointer
Definition: AnimationClip.h:31
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::AnimationClips::instance
static AnimationClips & instance()
Singleton access.
Atoms::AnimationClips::animationClipExists
bool animationClipExists(const std::string &name)
Check if an animation clip exists.
Atoms::AnimationClips::numAnimationClips
unsigned int numAnimationClips()
Get number of animation clips.
Atoms::AnimationClipPtr
AtomsPtr< AnimationClip > AnimationClipPtr
animation clip pointer
Definition: AnimationClip.h:27