11 #include <AtomsGraph/Ports.h>
12 #include <Atoms/Globals.h>
13 #include <Atoms/Graph/Operators/StateMachineBaseNodeOperator.h>
14 #include <Atoms/Graph/Operators/ClipReaderOperator.h>
15 #include <Atoms/AnimationClip.h>
16 #include <Atoms/Graph/AgentBehaviourNetwork.h>
17 #include <Atoms/Locomotion.h>
45 AtomsMath::Vector2 position;
72 inline OutputData& outputPortData(
size_t index) {
return m_outPortData[index]; }
74 inline size_t numOutputPorts()
const {
return m_outPortData.size(); }
76 void setLocomotionTriangles(
const std::vector<AtomsUtils::Triangle2>& triangles) { m_locomotionTriangles = triangles; };
78 void setSkipTriangles(
const std::set<int>& skipTriangles) { m_skipTriangles = skipTriangles; };
80 inline void setMaxAngularAcceleration(
const double value) { m_maxAngularAcceleration = value; };
82 inline void setMaxLinearAcceleration(
const double value) { m_maxLinearAcceleration = value; };
84 inline void setLinearAverageNumFrames(
const int value) { m_linearAverageNumFrames = value; };
86 inline void setAngularAverageNumFrames(
const int value) { m_angularAverageNumFrames = value; };
88 inline void setForcedUnsyncedClips(
const bool value) { m_forceUnsyncedClips = value; };
90 bool isReadyToTransition(
const OutputData& clipData,
double frameStep);
93 bool isReadyToTransition(
double frameRate = 1.0,
bool checkTransitionFrames =
true,
bool checkForceTransition =
true);
94 void advanceSingleClip(
double timeStep,
double frameStep,
bool randomClip =
false);
95 double computeBlendInOffset(
double frameRate,
bool checkTransitionFrames =
true);
96 void computeBlendInOffsetInPlace(
double frameRate,
bool checkTransitionFrames =
true);
97 double getBlendInOffset();
98 void prepareForBlendIn(
double offset,
double timeStep);
99 bool isBlendInStage(
double offset,
unsigned int blend);
100 bool isBlendOutStage(
double& frameDifference,
unsigned int blend);
101 double computeBlendInWeight(
double offset,
unsigned int blend);
102 double computeBlendOutWeight(
unsigned int blend);
103 void setUpBlendOutFrame(
double offset,
double timeStep);
104 bool isBlendOutFinished(
unsigned int blend);
105 void initSubState(
double frame);
106 bool hasClips() {
return false; };
107 void checkAndPlayUnsynced(
const int syncedMajorId,
const double deltaTime,
double& useClipDirection);
109 void buildNetwork(
const AtomsPtr<Atoms::StateMachine>& stateMachine,
const Atoms::AnimationState& state, std::map<std::string, std::string>& clipToAgentTypeNames, std::mutex& mutex,
const double timeOffset, AtomsCore::Rand32* idRandom);
113 WaitingState waitingState() {
return m_waitingState; };
117 const AtomsCore::Vector3f &barycentricCoordinates() {
return m_prevBarycentricCoordinates; };
119 const int unsyncedClipId() {
return m_unsyncedId; };
120 const bool forceUnsyncedClips() {
return m_forceUnsyncedClips; };
124 bool updateInputPosition();
125 bool shouldCheckNextUnsyncWaitFrames(
const OutputData& clipData,
double frameStep,
const int waitFrames);
128 bool computeBarycentricCoordinatesAndTriangle(AtomsMath::Vector3f& barycentricCoords,
AtomsUtils::Triangle2& outTriangle,
const bool cacheOnly =
false);
130 std::vector<OutputData> m_outPortData;
132 std::vector<AtomsUtils::Triangle2> m_locomotionTriangles;
133 std::set<int> m_skipTriangles;
135 std::deque<float> m_angularVelocities;
137 std::deque<float> m_linearVelocities;
150 double m_previousTime;
152 double m_previousUseClipDirection;
154 double m_maxAngularAcceleration;
156 double m_maxLinearAcceleration;
158 int m_currentUnsyncedStep;
160 int m_previousUnsyncedMajorId;
162 int m_currentMajorId;
168 int m_nextUnsyncedId;
172 int m_totNumWaitFrames;
174 int m_angularAverageNumFrames;
176 int m_linearAverageNumFrames;
178 WaitingState m_waitingState;
180 bool m_forceUnsyncedClips;
182 bool m_playingUnsynced;
Animation State.
Definition: AnimationState.h:25
Definition: BlendSpaceOperator.h:25
bool compute(const AtomsGraph::ComputeData *computeData)
Compute function.
void reset()
Operator reset function.
Definition: ClipReaderOperator.h:22
Definition: StateMachineBaseNodeOperator.h:27
Generic node port class.
Definition: PortTemplate.h:24
Triangle 2D class.
Definition: Triangle.h:87
AtomsMath::Vector2f Vector2f
Vector2 class.
Definition: AtomsMath.h:55
AtomsMath::Vector3f Vector3f
Vector3 class.
Definition: AtomsMath.h:58
Atoms namespace.
Definition: Agent.h:29
AtomsPtr< AnimationClip > AnimationClipPtr
animation clip pointer
Definition: AnimationClip.h:28
AtomsPtr< const Locomotion > LocomotionCPtr
locomotion const pointer
Definition: Locomotion.h:86
Definition: BlendSpaceOperator.h:38