83 ,
const IndexT skeletonIndex
85 ,
const IndexT animationIndex
87 ,
bool supportBlending =
true
105 const float weight = 1.0f,
106 const SizeT loopCount = 1,
107 const float startTime = 0.0f,
108 const float fadeIn = 0.0f,
109 const float fadeOut = 0.0f,
110 const float timeOffset = 0.0f,
111 const float timeFactor = 1.0f);
248 Resources::ResourceId,
static bool IsPlaying(const Graphics::GraphicsEntityId id)
check if any animation is playing
Definition charactercontext.cc:356
static void SetTrackWeight(const Graphics::GraphicsEntityId id, const IndexT track, const float weight)
set weight for track
Definition charactercontext.cc:372
static void QueryClips(const Graphics::GraphicsEntityId id, Util::FixedArray< CoreAnimation::AnimClip > &outClips)
retrieve animation clip names and lengths
Definition charactercontext.cc:406
static const IndexT GetPlayingClip(const Graphics::GraphicsEntityId id, const IndexT track)
get the clip playing on a track, InvalidIndex if none is
Definition charactercontext.cc:448
static const SkeletonId GetSkeleton(const Graphics::GraphicsEntityId id)
get the skeleton, invalid until it's loaded
Definition charactercontext.cc:417
static IndexT GetClipIndex(const Graphics::GraphicsEntityId id, const Util::StringAtom &name)
perform a clip name lookup
Definition charactercontext.cc:215
friend Timing::Tick GetAbsoluteStopTime(const CharacterContext::AnimationRuntime &runtime)
Definition charactercontext.cc:553
static void PauseTrack(const Graphics::GraphicsEntityId id, const IndexT track)
pause animation on track, which doesn't reset time
Definition charactercontext.cc:318
friend const bool IsExpired(const CharacterContext::AnimationRuntime &runtime, const Timing::Time time)
Definition charactercontext.cc:532
static CoreAnimation::AnimSampleMask * GetAnimSampleMask(const Util::StringAtom &name)
get anim sample mask by name
Definition charactercontext.cc:1038
static void OnRenderDebug(uint32_t flags)
debug rendering
Definition charactercontext.cc:1050
static bool SetupFromModel(const Graphics::GraphicsEntityId id, const IO::Path &model, const Util::StringAtom &tag)
if the entity's model is skinned, register and setup the entity as a character using the skeleton and...
Definition charactercontext.cc:187
static void SetTrackTimeFactor(const Graphics::GraphicsEntityId id, const IndexT track, const float factor)
set time factor for track
Definition charactercontext.cc:389
static void Setup(const Graphics::GraphicsEntityId id, const Resources::ResourceName &skeletonResource, const IndexT skeletonIndex, const Resources::ResourceName &animationResource, const IndexT animationIndex, const Util::StringAtom &tag, bool supportBlending=true)
setup character context, assumes there is already a model attached, by loading a skeleton and animati...
Definition charactercontext.cc:94
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition charactercontext.h:270
static void Seek(const Graphics::GraphicsEntityId id, const float time)
seek animation to a certain time, clamps to length
Definition charactercontext.cc:336
static bool PlayClip(const Graphics::GraphicsEntityId id, const CoreAnimation::AnimSampleMask *mask, const IndexT clipIndex, const IndexT track, const EnqueueMode mode, const float weight=1.0f, const SizeT loopCount=1, const float startTime=0.0f, const float fadeIn=0.0f, const float fadeOut=0.0f, const float timeOffset=0.0f, const float timeFactor=1.0f)
play animation on a specific track
Definition charactercontext.cc:225
static Timing::Time GetTrackTime(const Graphics::GraphicsEntityId id, const IndexT track)
get the time in the clip playing on a track in seconds, within its duration for looped clips,...
Definition charactercontext.cc:472
static void Create()
setup character context
Definition charactercontext.cc:52
static bool IsTrackPaused(const Graphics::GraphicsEntityId id, const IndexT track)
check if the clip playing on a track is paused
Definition charactercontext.cc:459
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition charactercontext.h:279
friend void EvalCharacter(SizeT totalJobs, SizeT groupSize, IndexT groupIndex, SizeT invocationOffset, void *ctx)
Definition charactercontext.cc:610
static void StopTrack(const Graphics::GraphicsEntityId id, const IndexT track)
stops all animations queued on track (and resets their time)
Definition charactercontext.cc:287
@ SampleBuffer
Definition charactercontext.h:224
@ JointPalette
Definition charactercontext.h:220
@ CharacterSkinNodeIndexOffset
Definition charactercontext.h:227
@ AnimTime
Definition charactercontext.h:219
@ UserControlledJoint
Definition charactercontext.h:222
@ EntityId
Definition charactercontext.h:226
@ JobJoints
Definition charactercontext.h:223
@ AnimationResource
Definition charactercontext.h:228
@ SupportMix
Definition charactercontext.h:225
@ AnimationIndex
Definition charactercontext.h:229
@ Loaded
Definition charactercontext.h:217
@ Skeleton
Definition charactercontext.h:215
@ JointPaletteScaled
Definition charactercontext.h:221
@ PendingFiredEvents
Definition charactercontext.h:231
@ FiredEvents
Definition charactercontext.h:230
@ TrackController
Definition charactercontext.h:218
static void WaitForCharacterJobs(const Graphics::FrameContext &ctx)
run after frame
Definition charactercontext.cc:1017
static Threading::Interlocked::AtomicCounter ConstantUpdateCounter
Definition charactercontext.h:175
static const CoreAnimation::AnimationId GetAnimation(const Graphics::GraphicsEntityId id)
get the animation, invalid until it's loaded
Definition charactercontext.cc:427
static const Util::Array< FiredEvent > & GetFiredEvents(const Graphics::GraphicsEntityId id)
get the events the clips played on the tracks passed in the last update that finished,...
Definition charactercontext.cc:522
static void StopAllTracks(const Graphics::GraphicsEntityId id)
stops all animations on all tracks
Definition charactercontext.cc:301
CharacterContext()
constructor
Definition charactercontext.cc:35
LoadState
Definition charactercontext.h:169
@ AnimationLoaded
Definition charactercontext.h:172
@ SkeletonLoaded
Definition charactercontext.h:171
@ NoneLoaded
Definition charactercontext.h:170
static Util::HashTable< Util::StringAtom, CoreAnimation::AnimSampleMask > masks
Definition charactercontext.h:260
static CoreAnimation::AnimSampleMask * CreateAnimSampleMask(const Util::StringAtom &name, const Util::FixedArray< Math::scalar > &weights)
register anim sample mask, and return pointer
Definition charactercontext.cc:1028
static const Util::FixedArray< Math::mat4 > & GetJointTransforms(const Graphics::GraphicsEntityId id)
get the model space transforms of the joints in the last evaluated pose, one per joint of the skeleto...
Definition charactercontext.cc:438
friend const bool IsInfinite(const CharacterContext::AnimationRuntime &runtime)
Definition charactercontext.cc:544
static CharacterContextAllocator characterContextAllocator
Definition charactercontext.h:253
static void SeekTrack(const Graphics::GraphicsEntityId id, const IndexT track, const Timing::Time time)
move the clip playing on a track to a time in it in seconds, it plays on from there,...
Definition charactercontext.cc:497
static const SizeT MaxNumTracks
Definition charactercontext.h:206
Ids::IdAllocator< SkeletonId, CoreAnimation::AnimationId, LoadState, AnimationTracks, Timing::Time, Util::FixedArray< Math::mat4 >, Util::FixedArray< Math::mat4 >, Util::FixedArray< Math::mat4 >, Util::FixedArray< SkeletonJobJoint >, CoreAnimation::AnimSampleBuffer, bool, Graphics::GraphicsEntityId, IndexT, Resources::ResourceId, IndexT, Util::Array< FiredEvent >, Util::Array< FiredEvent > > CharacterContextAllocator
Definition charactercontext.h:252
static Threading::Event totalCompletionEvent
Definition charactercontext.h:261
friend struct CharacterJobContext
Definition charactercontext.h:177
static const float GetTime(const Graphics::GraphicsEntityId id)
get current time of animation
Definition charactercontext.cc:346
static void UpdateAnimations(const Graphics::FrameContext &ctx)
runs before frame is updated
Definition charactercontext.cc:873
An animation event associates a name with a point in time.
Definition animevent.h:21
Stores the result of an animation sampling operation, stores samples key values and sample-counts whi...
Definition animsamplebuffer.h:22
Definition graphicscontext.h:175
A path is an abstraction around file paths.
Definition path.h:26
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Ids::Id32 Alloc()
Allocate an object.
Definition idallocator.h:46
void Dealloc(Ids::Id32 index)
Deallocate an object. Just places it in freeids array for recycling.
Definition idallocator.h:64
Nebula's dynamic array class.
Definition array.h:61
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
Organizes key/value pairs by a hash code.
Definition hashtable.h:42
A StringAtom.
Definition stringatom.h:22
Nebula's universal string class.
Definition string.h:50
Definition animeventhandlerbase.cc:10
A character encapsulates a skeleton resource, an animation resource, and the ability to instantiate s...
Definition charactercontext.cc:23
__ImplementEnumBitOperators(CharacterContext::LoadState)
EnqueueMode
Definition charactercontext.h:52
@ Replace
Definition charactercontext.h:54
@ IgnoreIfSame
Definition charactercontext.h:55
@ Append
Definition charactercontext.h:53
An animation resource holds a set of animations from a loaded NAX file.
Definition charactercontext.h:41
void AnimSampleJob(SizeT totalJobs, SizeT groupSize, IndexT groupIndex, SizeT invocationOffset, void *ctx)
void AnimSampleJobWithMix(SizeT totalJobs, SizeT groupSize, IndexT groupIndex, SizeT invocationOffset, void *ctx)
Util::StringAtom ResourceName
Definition resourceid.h:33
int Tick
the tick datatype (one tick == 1 millisecond)
Definition time.h:20
double Time
the time datatype
Definition time.h:18
Array< TYPE, STACK_SIZE > StackArray
Definition array.h:2051
Definition charactercontext.h:180
Timing::Tick prevEvalTime
Definition charactercontext.h:186
const CoreAnimation::AnimSampleMask * mask
Definition charactercontext.h:190
Timing::Tick timeOffset
Definition charactercontext.h:188
Timing::Tick baseTime
Definition charactercontext.h:183
bool paused
Definition charactercontext.h:193
EnqueueMode enqueueMode
Definition charactercontext.h:182
Timing::Tick sampleTime
Definition charactercontext.h:187
bool started
the base time is set once the clip starts playing, a clip replacing the playing one starts on the nex...
Definition charactercontext.h:195
Timing::Tick duration
Definition charactercontext.h:184
Timing::Tick startTime
Definition charactercontext.h:183
IndexT clip
Definition charactercontext.h:181
Timing::Tick prevSampleTime
Definition charactercontext.h:187
Timing::Tick evalTime
Definition charactercontext.h:186
Util::Array< uint > curveSampleIndices
Definition charactercontext.h:189
float timeFactor
Definition charactercontext.h:191
float blend
Definition charactercontext.h:192
Timing::Tick fadeOutTime
Definition charactercontext.h:185
Timing::Tick fadeInTime
Definition charactercontext.h:185
Definition charactercontext.h:208
AnimationRuntime playingAnimations[MaxNumTracks]
Definition charactercontext.h:210
Util::StackArray< AnimationRuntime, 8 > pendingAnimations[MaxNumTracks]
Definition charactercontext.h:209
an event a clip played on a track passed
Definition charactercontext.h:65
IndexT track
Definition charactercontext.h:68
CoreAnimation::AnimEvent event
Definition charactercontext.h:66
IndexT clip
Definition charactercontext.h:67
Definition animsamplemask.h:16
Definition animation.h:25
Definition graphicscontext.h:143
Definition graphicsserver.h:63
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
Atomic value only used to decrement, increment and read a 32 bit value.
Definition interlocked.h:214
#define N_BIT(x)
Definition types.h:60
int SizeT
Definition types.h:50
int IndexT
Definition types.h:49