void SetDuration(float durationSeconds);
/**
+ * Set the progress marker to trigger notification
+ * @param[in] progress percent of progress to trigger notification, 0.0f < progress <= 1.0f
+ */
+ void SetProgressNotification( float progress );
+
+ /**
* Retrieve the duration of the animation.
* @return The duration in seconds.
*/
*/
void Play();
- /*
+ /**
* Play the animation from a given point
* @param[in] progress A value between [0,1] form where the animation should start playing
*/
void PlayFrom( float progress );
/**
+ * @brief Play the animation after a given delay time.
+ * @param[in] delaySeconds The delay time
+ */
+ void PlayAfter( float delaySeconds );
+
+ /**
* Pause the animation.
*/
void Pause();
* @param[in] elapsedSeconds The time elapsed since the previous frame.
* @param[out] looped True if the animation looped
* @param[out] finished True if the animation has finished.
+ * @param[out] progressReached True if progress marker reached
*/
- void Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished );
+ void Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished, bool& progressReached );
protected:
protected:
+ AnimatorContainer mAnimators;
+
+ Vector2 mPlayRange;
+
float mDurationSeconds;
+ float mDelaySeconds;
+ float mElapsedSeconds;
float mSpeedFactor;
- EndAction mEndAction;
- EndAction mDisconnectAction;
+ float mProgressMarker; // Progress marker to trigger a notification
- State mState;
- float mElapsedSeconds;
int mPlayedCount; // Incremented at end of animation or completion of all loops
// Never incremented when looping forever. Event thread tracks to signal end.
int mLoopCount; // N loop setting
int mCurrentLoop; // Current loop number
- Vector2 mPlayRange;
- AnimatorContainer mAnimators;
+ EndAction mEndAction;
+ EndAction mDisconnectAction;
+
+ State mState;
+
+ bool mProgressReachedSignalRequired; // Flag to indicate the progress marker was hit
};
}; //namespace SceneGraph
new (slot) LocalType( &animation, &Animation::SetDuration, durationSeconds );
}
+inline void SetProgressNotificationMessage( EventThreadServices& eventThreadServices, const Animation& animation, float progress )
+{
+ typedef MessageValue1< Animation, float > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &animation, &Animation::SetProgressNotification, progress );
+}
+
+
inline void SetLoopingMessage( EventThreadServices& eventThreadServices, const Animation& animation, int loopCount )
{
typedef MessageValue1< Animation, int > LocalType;
new (slot) LocalType( &animation, &Animation::AddAnimator, parameter );
}
+inline void PlayAfterMessage( EventThreadServices& eventThreadServices, const Animation& animation, float delaySeconds )
+{
+ typedef MessageValue1< Animation, float > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &animation, &Animation::PlayAfter, delaySeconds );
+}
} // namespace SceneGraph