Nebula
|
#include <animjob.h>
Descibes a single animation sampling job in the AnimController.
AnimJob objects have a start time and a duration and are arranged in parallel tracks. The sampling results of parallel AnimJobs at a given point in time are mixed into a single resulting animation by the AnimController. Subclasses of AnimJob are used to implement specific tasks like a lookat-controller, IK, and so forth...
FIXME: the current implementation of setting an absolute evaluation time doesn't allow to manipulate the playback speed (for this, advancing the time by a relative amount would be better).
(C) 2008 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file
Inherits Core::RefCounted.
Inherited by Animation::PlayClipJob.
Public Member Functions | |
AnimJob () | |
constructor | |
virtual | ~AnimJob () |
destructor | |
void | SetName (const Util::StringAtom &id) |
set human readable name (only used for debugging) | |
const Util::StringAtom & | GetName () const |
get human readable name (only used for debugging) | |
bool | IsAttachedToSequencer () const |
return true if the job is currently attached to a sequencer | |
bool | IsActive (Timing::Tick time) const |
return true if the job has currently playing (EvalTime within start/end time) | |
bool | IsPending (Timing::Tick time) const |
return true if the job has been queued for playback but has not started yet | |
bool | IsStoppingOrExpired (Timing::Tick time) const |
return true if anim job is stopping or expired | |
bool | IsExpired (Timing::Tick time) const |
return true when the job has expired | |
bool | IsPaused () const |
returns true if the clip is playing, but has been paused | |
void | SetTrackIndex (IndexT trackIndex) |
set track index, defines blend priority and relationship to other jobs on same track | |
IndexT | GetTrackIndex () const |
get track index | |
void | SetEnqueueMode (AnimJobEnqueueMode::Code enqueueMode) |
set the enqueue behaviour of the new job (default is intercept) | |
AnimJobEnqueueMode::Code | GetEnqueueMode () const |
get the enqueue behaviour of the new job | |
void | SetExclusiveTag (IndexT id) |
exclusive tag (for AnimJobEnqueueMode::IgnoreIfSameExclTagActive) | |
IndexT | GetExclusiveTag () const |
exclusive flag set? | |
void | SetStartTime (Timing::Tick time) |
set the start time of the anim job (relative to base time) | |
Timing::Tick | GetStartTime () const |
get the start time of the anim job (relative to base time) | |
void | SetDuration (Timing::Tick time) |
set the duration of the anim job (0 == infinite) | |
Timing::Tick | GetDuration () const |
get the duration of the anim job | |
bool | IsInfinite () const |
return true if the anim job is infinite | |
void | SetFadeInTime (Timing::Tick fadeInTime) |
set the fade-in time of the anim job | |
Timing::Tick | GetFadeInTime () const |
get the fade-in time of the anim job | |
void | SetFadeOutTime (Timing::Tick fadeOutTime) |
set the fade-out time of the anim job | |
Timing::Tick | GetFadeOutTime () const |
get the fade-out time of the anim job | |
void | SetTime (Timing::Tick time) |
jump to a specific time in the job | |
Timing::Tick | GetTime () const |
get current time of anim job | |
void | SetTimeFactor (float timeFactor) |
set time factor | |
float | GetTimeFactor () const |
get time factor | |
void | SetTimeOffset (Timing::Tick timeOffset) |
set sample time offset (if sampling should not start at the beginning) | |
Timing::Tick | GetTimeOffset () const |
get sample time offset | |
void | SetBlendWeight (float w) |
set blend weight of the anim job (default is 1.0) | |
float | GetBlendWeight () const |
get blend weight of the anim job | |
void | SetMask (const Characters::CharacterJointMask *mask) |
set joint mask | |
const Characters::CharacterJointMask * | GetMask () const |
get joint mask | |
Timing::Tick | GetAbsoluteStartTime () const |
get the absolute start time (BaseTime + StartTime) | |
Timing::Tick | GetAbsoluteEndTime () const |
get the absolute end time (BaseTime + StartTime + Duration) | |
Timing::Tick | GetAbsoluteStopTime () const |
get the absolute, computed end time ((BaseTime + StartTime + Duration) - FadeOutTime) | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Protected Member Functions | |
void | SetBaseTime (Timing::Tick time) |
set the base time of the anim job (set by sequencer when job is attached) | |
Timing::Tick | GetBaseTime () const |
get the base time of the anim job | |
virtual void | OnAttachedToSequencer (const AnimSequencer &animSequencer) |
called when attached to anim sequencer | |
virtual void | OnRemoveFromSequencer () |
called when removed from sequencer | |
float | ComputeBlendWeight (Timing::Tick relEvalTime) const |
compute current blend weight, this should take fade-in into account | |
void | FixFadeTimes () |
fix fade-in/fade-out times if the sum is bigger then the play duration | |
virtual Ptr< Jobs::Job > | CreateEvaluationJob (Timing::Tick time, const Ptr< CoreAnimation::AnimSampleBuffer > &mixIn, const Ptr< CoreAnimation::AnimSampleBuffer > &result) |
create evaluation job for asynchronous evaluation | |
virtual Util::Array< AnimEventInfo > | EmitAnimEvents (Timing::Tick startTime, Timing::Tick endTime, const Util::String &optionalCatgeory) |
emit anim events inside given time range | |
virtual void | UpdateTimes (Timing::Tick time) |
compute sample time for next evaluation, always done, also if character isn't visible and no evaluation takes place | |
virtual void | Stop (Timing::Tick time) |
stop the anim job at the given time | |
virtual void | Pause (bool pause) |
pause the anim job at the given time | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
Protected Attributes | |
const AnimSequencer * | animSequencer |
const Characters::CharacterJointMask * | mask |
Util::StringAtom | name |
AnimJobEnqueueMode::Code | enqueueMode |
IndexT | trackIndex |
IndexT | exclusiveTag |
Timing::Tick | baseTime |
Timing::Tick | startTime |
Timing::Tick | duration |
Timing::Tick | fadeInTime |
Timing::Tick | fadeOutTime |
Timing::Tick | curRelEvalTime |
Timing::Tick | lastRelEvalTime |
Timing::Tick | curSampleTime |
Timing::Tick | lastSampleTime |
Timing::Tick | timeOffset |
float | timeFactor |
float | blendWeight |
bool | isPaused |
Private Member Functions | |
__DeclareClass (AnimJob) | |
Friends | |
class | AnimSequencer |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Animation::AnimJob::AnimJob | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
protected |
compute current blend weight, this should take fade-in into account
This is a helper method for subclasses and returns the current blend weight for the current relative evaluation time, taking the fade-in and fade-out phases into account.
|
protectedvirtual |
create evaluation job for asynchronous evaluation
This method is called by the AnimSequencer when this job is active (the current eval time is between the start and end time of the job).
The AnimJob object is expected to fill the provided AnimSampleBuffer with a result (sampled keys and sample counts, the sample counts indicate whether a given sample contributes to the final blended result. If the mixIn pointer is valid, the method must perform animation mixing as well.
This method is usually implemented by subclasses.
Reimplemented in Animation::PlayClipJob.
|
protectedvirtual |
emit anim events inside given time range
Reimplemented in Animation::PlayClipJob.
|
protected |
fix fade-in/fade-out times if the sum is bigger then the play duration
This method checks if the fade-in plus the fade-out times would be bigger then the play-duration, if yes it will fix the fade times in order to prevent "blend-popping".
Timing::Tick Animation::AnimJob::GetAbsoluteEndTime | ( | ) | const |
get the absolute end time (BaseTime + StartTime + Duration)
Return the absolute end time (BaseTime + StartTime + Duration).
Method fails hard if AnimJob is infinite.
Timing::Tick Animation::AnimJob::GetAbsoluteStartTime | ( | ) | const |
get the absolute start time (BaseTime + StartTime)
Returns the absolute start time (BaseTime + StartTime).
Timing::Tick Animation::AnimJob::GetAbsoluteStopTime | ( | ) | const |
get the absolute, computed end time ((BaseTime + StartTime + Duration) - FadeOutTime)
Returns the absolute end time before the fadeout-phase starts ((BaseTime + StartTime + Duration) - FadeOut)
|
inlineprotected |
get the base time of the anim job
|
inline |
get blend weight of the anim job
|
inline |
get the duration of the anim job
|
inline |
get the enqueue behaviour of the new job
|
inline |
exclusive flag set?
|
inline |
get the fade-in time of the anim job
|
inline |
get the fade-out time of the anim job
|
inline |
get joint mask
|
inline |
get human readable name (only used for debugging)
|
inline |
get the start time of the anim job (relative to base time)
|
inline |
get current time of anim job
|
inline |
get time factor
|
inline |
get sample time offset
|
inline |
get track index
bool Animation::AnimJob::IsActive | ( | Timing::Tick | time | ) | const |
return true if the job has currently playing (EvalTime within start/end time)
This method will return true if the current eval time is between the start time and end time of the anim job.
bool Animation::AnimJob::IsAttachedToSequencer | ( | ) | const |
return true if the job is currently attached to a sequencer
bool Animation::AnimJob::IsExpired | ( | Timing::Tick | time | ) | const |
return true when the job has expired
This method will return true if the current eval time is greater then the end time of the job.
|
inline |
return true if the anim job is infinite
|
inline |
returns true if the clip is playing, but has been paused
bool Animation::AnimJob::IsPending | ( | Timing::Tick | time | ) | const |
return true if the job has been queued for playback but has not started yet
This method will return true as long as the current eval time is before the start time (the job hasn't started yet).
bool Animation::AnimJob::IsStoppingOrExpired | ( | Timing::Tick | time | ) | const |
return true if anim job is stopping or expired
Return true if the anim job is currently in or after the fade-out phase.
|
protectedvirtual |
called when attached to anim sequencer
Reimplemented in Animation::PlayClipJob.
|
protectedvirtual |
called when removed from sequencer
|
protectedvirtual |
pause the anim job at the given time
Pause the anim job at the given time.
Unpauses if already paused.
|
inlineprotected |
set the base time of the anim job (set by sequencer when job is attached)
|
inline |
set blend weight of the anim job (default is 1.0)
|
inline |
set the duration of the anim job (0 == infinite)
|
inline |
set the enqueue behaviour of the new job (default is intercept)
|
inline |
exclusive tag (for AnimJobEnqueueMode::IgnoreIfSameExclTagActive)
|
inline |
set the fade-in time of the anim job
|
inline |
set the fade-out time of the anim job
|
inline |
set joint mask
|
inline |
set human readable name (only used for debugging)
|
inline |
set the start time of the anim job (relative to base time)
|
inline |
jump to a specific time in the job
|
inline |
set time factor
|
inline |
set sample time offset (if sampling should not start at the beginning)
|
inline |
set track index, defines blend priority and relationship to other jobs on same track
|
protectedvirtual |
stop the anim job at the given time
Stop the anim job at the given time.
This will just update the duration member.
|
protectedvirtual |
compute sample time for next evaluation, always done, also if character isn't visible and no evaluation takes place
Updates evaluation times.
Must be done every frame, even if character is not visible and so animjob is not evaluated.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |