Nebula
Loading...
Searching...
No Matches
animsequencer.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
18#include "core/refcounted.h"
19#include "animation/animjob.h"
21#include "jobs/jobport.h"
23
24//------------------------------------------------------------------------------
25namespace Animation
26{
28{
29public:
34
38 void Discard();
40 bool IsValid() const;
42 void SetDebugHudEnabled(bool b);
44 bool IsDebugHudEnabled() const;
45
47 void EnqueueAnimJob(const Ptr<AnimJob>& animJob);
49 void StopTrack(IndexT trackIndex, bool allowFadeOut=true);
51 void StopAllTracks(bool allowFadeOut=true);
53 void PauseTrack(IndexT trackIndex, bool pause);
55 void PauseAllTracks(bool pause);
56
59
63 bool StartAsyncEvaluation(const Ptr<Jobs::JobPort>& jobPort);
64
66 Timing::Tick GetTime() const;
77
79 Util::Array<AnimEventInfo> EmitAnimEvents(Timing::Tick startTime, Timing::Tick endTime, bool justDominatingJob, const Util::String& optionalCategory = "") const;
80
81private:
83 void EnqueueAnimJobForStopping(const Ptr<AnimJob>& animJob);
85 void DiscardAnimJob(Ptr<AnimJob> animJob);
94
97
98 #if NEBULA_ANIMATIONSYSTEM_FRAMEDUMP
100 void DumpFrameDebugInfo(Timing::Tick time);
101 #endif
111 void DebugRenderAnimJobText(Timing::Tick timeOrigin, const Ptr<AnimJob>& animJob, const Math::float4& color);
114
118
119 Util::Array<Ptr<AnimJob> > enqueuedAnimJobs; // anim jobs started this "frame"
120 Util::Array<Ptr<AnimJob> > stoppedAnimJobs; // anim jobs stopped this "frame"
121 Util::Array<Ptr<AnimJob> > animJobs; // currently sequenced anim jobs
122
123 Util::Array<Ptr<Jobs::Job> > jobChain; // need to keep jobs around until they are finished!
125};
126
127//------------------------------------------------------------------------------
130inline Timing::Tick
132{
133 return this->time;
134}
135
136//------------------------------------------------------------------------------
139inline bool
141{
142 return this->animResource.isvalid();
143}
144
145//------------------------------------------------------------------------------
150{
151 return this->dstSampleBuffer;
152}
153
154//------------------------------------------------------------------------------
159{
160 return this->animResource;
161}
162
163//------------------------------------------------------------------------------
166inline void
168{
169 this->debugHudEnabled = b;
170}
171
172//------------------------------------------------------------------------------
175inline bool
177{
178 return this->debugHudEnabled;
179}
180
181} // namespace Animation
182//------------------------------------------------------------------------------
An AnimSequencer object arranges AnimJobs along the time line to produce a single,...
Definition animsequencer.h:28
void DebugRenderHud(Timing::Tick time)
render a graphical debug hud
Definition animsequencer.cc:768
void DebugGenAnimJobRectangle(Timing::Tick timeOrigin, const Ptr< AnimJob > &animJob, Util::Array< CoreGraphics::RenderShape::RenderShapeVertex > &outVertices)
generate a debug visualization rectangle for an anim job
Definition animsequencer.cc:819
void Setup(const Ptr< CoreAnimation::AnimResource > &animResource)
setup the animation controller
Definition animsequencer.cc:49
bool debugHudEnabled
Definition animsequencer.h:124
Timing::Tick GetTime() const
get the currently set time
Definition animsequencer.h:131
void StopTrack(IndexT trackIndex, bool allowFadeOut=true)
stop all anim jobs on given track
Definition animsequencer.cc:182
void UpdateStoppedAnimJobs(Timing::Tick time)
update stopped anim jobs (called from UpdateTime)
Definition animsequencer.cc:406
Ptr< CoreAnimation::AnimSampleBuffer > dstSampleBuffer
Definition animsequencer.h:117
void PauseTrack(IndexT trackIndex, bool pause)
pauses all anim jobs on a given track
Definition animsequencer.cc:237
IndexT FindDominatingAnimJobIndex(Timing::Tick startTime, Timing::Tick endTime) const
FIXME FIXME FIXME: helper method, for determining dominating job.
Definition animsequencer.cc:710
Util::Array< Ptr< AnimJob > > animJobs
Definition animsequencer.h:121
const Ptr< CoreAnimation::AnimSampleBuffer > & GetResult() const
get the final sampled result of the last evaluation
Definition animsequencer.h:149
AnimSequencer()
constructor
Definition animsequencer.cc:27
Util::Array< Ptr< AnimJob > > enqueuedAnimJobs
Definition animsequencer.h:119
void PauseAllTracks(bool pause)
pauses all animations on all tracks
Definition animsequencer.cc:253
void DiscardAnimJob(Ptr< AnimJob > animJob)
discard a single anim job immediately from the sequencer
Definition animsequencer.cc:149
bool IsDebugHudEnabled() const
get debug hud enabled state
Definition animsequencer.h:176
void RemoveExpiredAnimJobs(Timing::Tick time)
delete expired anim jobs
Definition animsequencer.cc:462
Util::Array< Ptr< AnimJob > > GetAllAnimJobs() const
get all anim jobs
Definition animsequencer.cc:597
~AnimSequencer()
destructor
Definition animsequencer.cc:37
Util::Array< AnimEventInfo > EmitAnimEvents(Timing::Tick startTime, Timing::Tick endTime, bool justDominatingJob, const Util::String &optionalCategory="") const
FIXME FIXME FIXME: emit anim event infos.
Definition animsequencer.cc:672
void EnqueueAnimJobForStopping(const Ptr< AnimJob > &animJob)
stop a single anim job allowing fade-out (private helper method)
Definition animsequencer.cc:125
bool IsValid() const
return true if between Setup/Discard
Definition animsequencer.h:140
Util::Array< Ptr< AnimJob > > GetAnimJobsByTrackIndex(IndexT trackIndex) const
get currently active anim jobs filtered by track index
Definition animsequencer.cc:614
void SetTime(Timing::Tick time)
sets time for all tracks in sequencer
Definition animsequencer.cc:266
Timing::Tick time
Definition animsequencer.h:115
Ptr< CoreAnimation::AnimResource > animResource
Definition animsequencer.h:116
void UpdateTime(Timing::Tick time)
update the animation sequencer time
Definition animsequencer.cc:486
void DebugRenderAnimJobText(Timing::Tick timeOrigin, const Ptr< AnimJob > &animJob, const Math::float4 &color)
debug visualization: render the anim job text
Definition animsequencer.cc:842
void DebugGenTrackLines(SizeT maxTracks, Util::Array< CoreGraphics::RenderShape::RenderShapeVertex > &outVertices)
debug visualization: generate the lines for the track list
Definition animsequencer.cc:801
void InsertEnqueuedAnimJobs(Timing::Tick time)
insert new anim jobs (called from UpdateTime)
Definition animsequencer.cc:295
CoreGraphics::RenderShape::RenderShapeVertex DebugViewSpaceCoord(Timing::Tick timeOrigin, Timing::Tick time, IndexT trackIndex)
compute a screen coordinate (0..1) for a time and track index
Definition animsequencer.cc:867
void DebugRenderLineList(const Util::Array< CoreGraphics::RenderShape::RenderShapeVertex > &vertices, const Math::float4 &color)
debug visualization: render a line list (FIXME: something like this should be offered by the debug re...
Definition animsequencer.cc:885
const Ptr< CoreAnimation::AnimResource > & GetAnimResource() const
get pointer to animation resource object
Definition animsequencer.h:158
void Discard()
discard the anim sequencer
Definition animsequencer.cc:68
bool StartAsyncEvaluation(const Ptr< Jobs::JobPort > &jobPort)
start asynchronous animation update, returns false if nothing had to be done
Definition animsequencer.cc:522
void StopAllTracks(bool allowFadeOut=true)
stop all animations on all tracks
Definition animsequencer.cc:213
Util::Array< Ptr< Jobs::Job > > jobChain
Definition animsequencer.h:123
void SetDebugHudEnabled(bool b)
enable/disable the debug hud
Definition animsequencer.h:167
Util::Array< Ptr< AnimJob > > stoppedAnimJobs
Definition animsequencer.h:120
void UpdateTimeActiveAnimJobs(Timing::Tick time)
update active animjobs times
Definition animsequencer.cc:582
Util::Array< Ptr< AnimJob > > GetAnimJobsByName(const Util::StringAtom &name) const
get anim jobs by name
Definition animsequencer.cc:640
void EnqueueAnimJob(const Ptr< AnimJob > &animJob)
enqueue an anim job
Definition animsequencer.cc:104
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
bool isvalid() const
check if pointer is valid
Definition ptr.h:435
Nebula's dynamic array class.
Definition array.h:60
A StringAtom.
Definition stringatom.h:22
Definition animeventhandlerbase.cc:10
int Tick
the tick datatype (one tick == 1 millisecond)
Definition time.h:20
Definition scalar.h:76
Nebula's universal string class.
Definition string.h:50
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48