41 #ifndef INCLUDED_GLS_ANIMATION_JUGGLER_H
42 #define INCLUDED_GLS_ANIMATION_JUGGLER_H
62 typedef stdortr1::shared_ptr<GlsAnimationJuggler>
Ptr;
76 typedef Detail::ID
ID;
103 template<
class Animation>
106 DisplayFrame* displayFrame = 0,
108 double playbackSpeed = 1,
110 Key startKey = Detail::g_nan,
111 Key endKey = Detail::g_nan)
139 template<
class Animation,
class Observer>
143 DisplayFrame* displayFrame = 0,
145 double playbackSpeed = 1,
147 Key startKey = Detail::g_nan,
148 Key endKey = Detail::g_nan,
182 Key
GetKey( ID
id )
const;
199 AnimationData() : delayUntilKey( Detail::g_nan ), startKey( Detail::g_nan ), endKey( Detail::g_nan ), speed(1), loopBehavior(
PLAY_ONCE ), id(
GetInvalidID() ), direction( 1 )
213 : animation( animation_ )
214 , observer( observer_ )
215 , delayUntilKey( delayUntilKey_ )
216 , startKey( startKey_ )
219 , loopBehavior( loopBehavior_ )
221 , direction( direction_ )
223 DistiAssert( speed >= 0.0f );
224 DistiAssert( 1==direction || -1==direction );
229 void CalcStartEndKeys()
234 const auto animationMinMax = animation->GetMinMaxKeys();
235 if (Detail::IsNaN( startKey ) || startKey < animationMinMax.first)
237 startKey = animationMinMax.first;
239 if (Detail::IsNaN( endKey ) || endKey > animationMinMax.second)
241 endKey = animationMinMax.second;
248 static bool HasAnimationEnded(
const Key& key,
const AnimationData& animationData,
const int direction);
254 explicit HasID( ID id_ ) : id(id_) {}
255 bool operator()(
const AnimationData& animationData )
const {
return animationData.id == id; }
258 typedef std::vector<AnimationData> AnimationList;
259 typedef AnimationList::iterator AnimationIter;
260 typedef AnimationList::const_iterator AnimationConstIter;
264 AnimationList _animationList;
265 AnimationList _animationListAdvanceCopy;
266 bool _isAnimationListAdvanceCopyStale;
271 std::pair<Key, int> ComputeKeyAndDirection(
const AnimationData& animationData, Key dtm,
bool& notifyCompleted )
const;
278 DisplayFrame* displayFrame,
280 double playbackSpeed,
void SetKey(Key key)
Definition: gls_animation_juggler.cpp:375
A class used to schedule and manage multiple animations.
Definition: gls_animation_juggler.h:59
void CancelAllAnimations()
Cancels all scheduled animations. No animation complete notifications are sent.
Definition: gls_animation_juggler.cpp:399
Plays the animation from its starting value to its ending value, and then from its ending value to it...
Definition: gls_animation_juggler.h:69
Detail::ID ID
Animation ID used to cancel animations.
Definition: gls_animation_juggler.h:76
Create our own version of meta-function which is not available on all our target platfo...
Definition: gls_animation.h:731
stdortr1::shared_ptr< GlsAnimation > Ptr
Alias for easier reading.
Definition: gls_animation.h:60
The GL Studio animation observer class and helpers used by the juggler.
stdortr1::shared_ptr< GlsAnimationJuggler > Ptr
Alias for easier reading.
Definition: gls_animation_juggler.h:62
~GlsAnimationJuggler()
Destructor.
Definition: gls_animation_juggler.cpp:68
ID Schedule(Animation animation, Observer observer, DisplayFrame *displayFrame=0, LoopBehavior loop=PLAY_ONCE, double playbackSpeed=1, Key delayKey=0, Key startKey=Detail::g_nan, Key endKey=Detail::g_nan, typename Detail::enable_if< !Detail::is_convertible< Observer, DisplayFrame * >::value >::type *=0)
Definition: gls_animation_juggler.h:140
Plays the animation from its starting value to its ending value, and then removes the animation...
Definition: gls_animation_juggler.h:67
void Cancel(ID id)
Definition: gls_animation_juggler.cpp:381
Key GetKey(ID id) const
Definition: gls_animation_juggler.cpp:415
GlsKeyframeCurveBase::Key Key
Alias for easier reading.
Definition: gls_animation_juggler.h:73
The GL Studio keyframe animation classes.
static ID GetInvalidID()
Gets the sentinel value for when scheduling fails.
Definition: gls_animation_juggler.cpp:76
GlsAnimationJuggler(Key currentTime=0)
Definition: gls_animation_juggler.cpp:61
LoopBehavior
Specifies looping behaviors for animations.
Definition: gls_animation_juggler.h:65
Plays the animation from its starting value to its ending value, and then wraps around to the startin...
Definition: gls_animation_juggler.h:68
The GL Studio animation classes.
stdortr1::shared_ptr< GlsAnimationObserverBase > Ptr
Alias for easier reading.
Definition: gls_animation_observer.h:53
Replacement for std::is_convertible, adapted from Loki 0.1.7.
Definition: gls_animation.h:784
ID Schedule(Animation animation, DisplayFrame *displayFrame=0, LoopBehavior loop=PLAY_ONCE, double playbackSpeed=1, Key delayKey=0, Key startKey=Detail::g_nan, Key endKey=Detail::g_nan)
Definition: gls_animation_juggler.h:104
Definition: gls_animation.cpp:64
void Advance(Key dt)
Definition: gls_animation_juggler.cpp:290
double Key
The key type (usually time, but not always)
Definition: gls_keyframe.h:76