Atoms Crowd  7.0.0
AnimationState.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 <AtomsCore/Globals.h>
12 #include <AtomsCore/AtomsMath.h>
13 #include <Atoms/AnimationStateClip.h>
14 
15 #include <vector>
16 #include <string>
17 
18 
19 namespace Atoms
20 {
22 
24  class ATOMS_EXPORT AnimationState
25  {
26  public:
27 
30 
32 
36  AnimationState(const std::string &name, int id);
37 
39 
47  const std::string &name,
48  int id,
49  const AtomsCore::Vector3 maxTurn,
50  unsigned int blendIn,
51  unsigned int blendOut
52  );
53 
55 
64  const std::string &name,
65  int id,
66  const AtomsCore::Vector3 maxTurn,
67  unsigned int blendIn,
68  unsigned int blendOut,
69  bool randomLoop
70  );
71 
73 
83  const std::string& name,
84  int id,
85  const AtomsCore::Vector3 maxTurn,
86  unsigned int blendIn,
87  unsigned int blendOut,
88  bool randomLoop,
89  double velocity
90  );
91 
94 
97 
100 
102 
105  inline void setName(const std::string &name);
106 
108 
111  inline const std::string& name() const;
112 
114 
117  inline void addClip(const AnimationStateClip &clip);
118 
120 
123  inline void removeClip(unsigned int &clipId);
124 
126 
130  inline const AnimationStateClip& clip(unsigned int clipId) const;
131 
133 
137  inline AnimationStateClip& clip(unsigned int clipId);
138 
140 
143  inline unsigned int numClips() const;
144 
146  inline void clearClips();
147 
149 
152  inline void setId(int id);
153 
155 
158  inline int id() const;
159 
161 
164  inline bool isEmpty() const;
165 
167 
170  inline void setMaxTurnAngle(const AtomsCore::Vector3& angle);
171 
173 
176  inline const AtomsCore::Vector3& maxTurnAngle() const;
177 
179 
182  inline void setMaxAcceleration(const AtomsCore::Vector2& acceleration);
183 
185 
188  inline const AtomsCore::Vector2& maxAcceleration() const;
189 
191 
194  inline void setAverageNumFrames(const AtomsCore::Vector2i& averageNumFrames);
195 
197 
200  inline const AtomsCore::Vector2i& averageNumFrames() const;
201 
203 
206  inline void setBlendInFrames(unsigned int frames);
207 
209 
212  inline unsigned int blendInFrames() const;
213 
215 
218  inline void setBlendOutFrames(unsigned int frames);
219 
221 
224  inline unsigned int blendOutFrames() const;
225 
227 
230  inline void setRandomLoop(bool value);
231 
233 
236  inline bool randomLoop() const;
237 
239 
242  inline const std::vector<unsigned int>& validClips() const;
243 
245 
248  inline const std::vector<unsigned int>& validMotionTypeClips(unsigned int motionType) const;
249 
251  /* Updated the valid clips list of this state, resolving the priority between
252  Exclusive / Merge / Random mode
253  */
255 
257 
260  inline void setVelocity(double velocity);
261 
263 
266  inline double velocity() const;
267 
269 
272  inline void setIsLocomotion(const bool value);
273 
275 
278  inline bool isLocomotion() const;
279 
281 
284  inline void setLocomotionName(const std::string& value);
285 
287 
290  inline const std::string& locomotionName() const;
291 
292  private:
293 
295  std::string m_name;
296 
298  std::string m_locomotionName;
299 
301  std::vector<AnimationStateClip> m_clips;
302 
304  std::vector<unsigned int> m_validClips;
305 
307  std::vector<std::vector<unsigned int>> m_validMotionTypeClips;
308 
310  AtomsCore::Vector3 m_maxTurnAngle;
311 
313  AtomsCore::Vector2 m_maxAcceleration;
314 
316  AtomsCore::Vector2i m_averageNumFrames;
317 
319  double m_velocity;
320 
322  unsigned int m_blendInFrames;
323 
325  unsigned int m_blendOutFrames;
326 
328  int m_id;
329 
331  bool m_randomLoop;
332 
334  bool m_isLocomotion;
335 
336  };
337 }
338 
339 
340 #include "AnimationState.impl.h"
Animation State clip.
Definition: AnimationStateClip.h:23
Animation State.
Definition: AnimationState.h:25
AnimationState(const AnimationState &other)
Copy constructor.
AnimationState()
Constructor.
AnimationState(const std::string &name, int id, const AtomsCore::Vector3 maxTurn, unsigned int blendIn, unsigned int blendOut, bool randomLoop)
Constructor.
AnimationState(const std::string &name, int id, const AtomsCore::Vector3 maxTurn, unsigned int blendIn, unsigned int blendOut)
Constructor.
AnimationState & operator=(const AnimationState &other)
Assign Operator.
AnimationState(const std::string &name, int id, const AtomsCore::Vector3 maxTurn, unsigned int blendIn, unsigned int blendOut, bool randomLoop, double velocity)
Constructor.
AnimationState(const std::string &name, int id)
Constructor.
void updateValidClips()
Updated the valid clips list of this state.
~AnimationState()
Destructor.
AtomsMath::Vector2 Vector2
Vector2 class.
Definition: AtomsMath.h:54
AtomsMath::Vector2i Vector2i
Vector2 class.
Definition: AtomsMath.h:56
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Atoms namespace.
Definition: Agent.h:29