11 #include <AtomsGraph/Ports.h>
12 #include <Atoms/Globals.h>
13 #include <Atoms/Graph/Operator.h>
14 #include <Atoms/AnimationClip.h>
15 #include <Atoms/AnimationState.h>
16 #include <Atoms/StateMachine.h>
17 #include <Atoms/Graph/AgentBehaviourNetwork.h>
18 #include <unordered_map>
20 #include <Atoms/Graph/Operators/StateMachineBaseNodeOperator.h>
38 std::vector<unsigned int> clips;
39 int currentRandomClip;
46 SubState() : offset(0.0), hash(-1), isTurning(
false), transitionStarted(
false), bypass(
false) {}
47 std::vector<unsigned> ids;
51 bool transitionStarted;
95 framesBlendInOffset(0),
107 useClipDirection(
false),
111 frameOffsetPort(
nullptr)
122 double framesBlendInOffset;
124 unsigned int mergeType;
125 unsigned int motionType;
129 double previousAngle;
131 unsigned int numBlendFrames;
134 bool useClipDirection;
142 NODE_STANDARD_MEMBERS
152 void updateTurningData(
160 void initializeFirstFrame(
165 void advanceSingleClip(
double timeStep,
double frameStep,
bool randomClip =
false);
171 double updateTurnWeights(
MotionType& motionType,
double turnAngled,
double& straight_weight,
double maxWeight);
173 void computeTurnWeights(
double maxWeight);
175 std::pair<int, int> getUnsyncedClipId();
177 int getUnsyncedClip(
MotionType& motionData,
double turnAngled);
179 void buildNetwork(
const AtomsPtr<Atoms::StateMachine>& stateMachine,
const Atoms::AnimationState &state, std::map<std::string, std::string>& clipToAgentTypeNames, std::mutex& mutex,
const double starFrame, AtomsCore::Rand32* idRandom);
181 bool isReadyToTransition(
double frameRate = 1.0,
bool checkTransitionFrames =
true,
bool checkForceTransition =
true);
182 double computeBlendInOffset(
double frameRate,
bool checkTransitionFrames =
true);
183 void computeBlendInOffsetInPlace(
double frameRate,
bool checkTransitionFrames =
true);
184 double getBlendInOffset();
185 double getBlendInOffset(
int clipId);
186 void prepareForBlendIn(
double offset,
double timeStep);
187 void prepareClipForBlendIn(
int clipId,
double offset);
188 int getActiveClipId();
189 bool isBlendInStage(
double offset,
unsigned int blend);
190 bool isBlendInStage(
int clipId,
double offset,
unsigned int blend);
191 bool isBlendOutStage(
double& frameDifference,
unsigned int blend);
192 double computeBlendInWeight(
double offset,
unsigned int blend);
193 double computeBlendInWeight(
int clipId,
double offset,
unsigned int blend);
194 double computeBlendOutWeight(
unsigned int blend);
195 double computeBlendOutWeight(
int clipId,
unsigned int blend);
196 void setUpBlendOutFrame(
double offset,
double timeStep);
197 bool isBlendOutFinished(
unsigned int blend);
198 void setClipFrameAndWeights();
199 void initSubState(
double frame);
201 bool hasClips() {
return m_clips.size() > 0; };
205 std::vector<double> m_frames;
207 std::vector<MotionType> m_motionInfo;
209 std::vector<ClipData> m_clips;
211 std::vector<AdditiveClipData> m_additiveClips;
213 std::vector<std::string> m_clipNames;
215 std::list<SubState> m_subStateQueue;
217 AtomsCore::Rand32* m_idRandom;
227 double m_previousTime;
231 unsigned int m_postRandClipId;
234 bool m_transitionStarted;
237 bool m_needLockDirectionForTurning;
Animation State.
Definition: AnimationState.h:25
Definition: AnimationStateOperator.h:56
Definition: AnimationStateOperator.h:84
Definition: AnimationStateOperator.h:31
Definition: AnimationStateOperator.h:44
Definition: AnimationStateOperator.h:27
bool compute(const AtomsGraph::ComputeData *computeData)
Compute function.
void reset()
Operator reset function.
Definition: StateMachineBaseNodeOperator.h:27
Generic node port class.
Definition: PortTemplate.h:24
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Atoms namespace.
Definition: Agent.h:29
AtomsPtr< AnimationClip > AnimationClipPtr
animation clip pointer
Definition: AnimationClip.h:28