Atoms Crowd  7.0.0
AnimationState.impl.h
1 // ===========================================================================
2 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
3 //
4 // Use of this software is subject to the terms of the Toolchefs license
5 // agreement provided at the time of installation or download, or which
6 // otherwise accompanies this software in either electronic or hard copy form.
7 // ===========================================================================
8 
9 namespace Atoms
10 {
11  void AnimationState::setName(const std::string &name)
12  {
13  m_name = name;
14  }
15 
16 
17  const std::string& AnimationState::name() const
18  {
19  return m_name;
20  }
21 
22 
23  void AnimationState::setId(int id)
24  {
25  m_id = id;
26  }
27 
28 
29  int AnimationState::id() const
30  {
31  return m_id;
32  }
33 
35  {
36  return (!m_isLocomotion && m_clips.size() == 0) && (m_isLocomotion && m_locomotionName.length() == 0);
37  }
38 
40  {
41  m_clips.push_back(clip);
42  }
43 
44  void AnimationState::removeClip(unsigned int &clipId)
45  {
46  if (clipId < m_clips.size())
47  {
48  auto it = m_clips.begin();
49  std::advance(it, clipId);
50  m_clips.erase(it);
51  }
52  }
53 
54  const AnimationStateClip& AnimationState::clip(unsigned int clipId) const
55  {
56  return m_clips[clipId];
57  }
58 
60  {
61  return m_clips[clipId];
62  }
63 
64  unsigned int AnimationState::numClips() const
65  {
66  return static_cast<unsigned int>(m_clips.size());
67  }
68 
70  {
71  m_clips.clear();
72  }
73 
75  {
76  m_maxTurnAngle = angle;
77  }
78 
80  {
81  return m_maxTurnAngle;
82  }
83 
85  {
86  m_maxAcceleration = acceleration;
87  }
88 
90  {
91  return m_maxAcceleration;
92  }
93 
95  {
96  m_averageNumFrames = averageNumFrames;
97  }
98 
100  {
101  return m_averageNumFrames;
102  }
103 
104  void AnimationState::setBlendInFrames(unsigned int frames)
105  {
106  m_blendInFrames = frames;
107  }
108 
109  unsigned int AnimationState::blendInFrames() const
110  {
111  return m_blendInFrames;
112  }
113 
114  void AnimationState::setBlendOutFrames(unsigned int frames)
115  {
116  m_blendOutFrames = frames;
117  }
118 
119  unsigned int AnimationState::blendOutFrames() const
120  {
121  return m_blendOutFrames;
122  }
123 
125  {
126  m_randomLoop = value;
127  }
128 
130  {
131  return m_randomLoop;
132  }
133 
134  const std::vector<unsigned int>& AnimationState::validClips() const
135  {
136  return m_validClips;
137  }
138 
139  const std::vector<unsigned int>& AnimationState::validMotionTypeClips(unsigned int motionType) const
140  {
141  return m_validMotionTypeClips[motionType];
142  }
143 
144  void AnimationState::setVelocity(double velocity)
145  {
146  m_velocity = velocity;
147  }
148 
150  {
151  return m_velocity;
152  }
153 
154  void AnimationState::setIsLocomotion(const bool value)
155  {
156  m_isLocomotion = value;
157  }
158 
160  {
161  return m_isLocomotion;
162  }
163 
164  void AnimationState::setLocomotionName(const std::string& value)
165  {
166  m_locomotionName = value;
167  }
168 
169  const std::string& AnimationState::locomotionName() const
170  {
171  return m_locomotionName;
172  }
173 }
Animation State clip.
Definition: AnimationStateClip.h:23
void setMaxTurnAngle(const AtomsCore::Vector3 &angle)
Sets max turn angle.
Definition: AnimationState.impl.h:74
void setName(const std::string &name)
Sets the state name.
Definition: AnimationState.impl.h:11
void setMaxAcceleration(const AtomsCore::Vector2 &acceleration)
Sets max linear and angular acceleration.
Definition: AnimationState.impl.h:84
void setLocomotionName(const std::string &value)
Sets the locomotion name.
Definition: AnimationState.impl.h:164
bool randomLoop() const
Gets random loop flag.
Definition: AnimationState.impl.h:129
void setBlendOutFrames(unsigned int frames)
Sets blend out frames.
Definition: AnimationState.impl.h:114
const std::string & name() const
Gets the state name.
Definition: AnimationState.impl.h:17
void clearClips()
Removes all animation state clips.
Definition: AnimationState.impl.h:69
unsigned int numClips() const
Gets the number of animation state clips.
Definition: AnimationState.impl.h:64
double velocity() const
Gets the state velocity.
Definition: AnimationState.impl.h:149
void setVelocity(double velocity)
Sets the state velocity.
Definition: AnimationState.impl.h:144
void setRandomLoop(bool value)
Set random loop flag.
Definition: AnimationState.impl.h:124
const AtomsCore::Vector3 & maxTurnAngle() const
Gets max turn angle.
Definition: AnimationState.impl.h:79
void setAverageNumFrames(const AtomsCore::Vector2i &averageNumFrames)
Sets linear and angular average num frames.
Definition: AnimationState.impl.h:94
const AtomsCore::Vector2 & maxAcceleration() const
Gets max acceleration.
Definition: AnimationState.impl.h:89
const AnimationStateClip & clip(unsigned int clipId) const
Gets an animation state clip.
Definition: AnimationState.impl.h:54
void setBlendInFrames(unsigned int frames)
Sets blend in frames.
Definition: AnimationState.impl.h:104
void setId(int id)
Sets the state id.
Definition: AnimationState.impl.h:23
unsigned int blendInFrames() const
Gets blend in frames.
Definition: AnimationState.impl.h:109
unsigned int blendOutFrames() const
Gets blend out frames.
Definition: AnimationState.impl.h:119
void setIsLocomotion(const bool value)
Sets the locomotion state.
Definition: AnimationState.impl.h:154
bool isEmpty() const
Checks if the state has no clip.
Definition: AnimationState.impl.h:34
void removeClip(unsigned int &clipId)
Removes a clip.
Definition: AnimationState.impl.h:44
const std::vector< unsigned int > & validMotionTypeClips(unsigned int motionType) const
Gets valid clips of a motion type.
Definition: AnimationState.impl.h:139
bool isLocomotion() const
Gets the locomotion state.
Definition: AnimationState.impl.h:159
int id() const
Gets the state id.
Definition: AnimationState.impl.h:29
const AtomsCore::Vector2i & averageNumFrames() const
Gets max acceleration.
Definition: AnimationState.impl.h:99
const std::string & locomotionName() const
Gets the locomotion name.
Definition: AnimationState.impl.h:169
const std::vector< unsigned int > & validClips() const
Gets valid clips.
Definition: AnimationState.impl.h:134
void addClip(const AnimationStateClip &clip)
Adds a animation state clip.
Definition: AnimationState.impl.h:39
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