Nebula
Loading...
Searching...
No Matches
Characters Namespace Reference

Detailed Description

A character encapsulates a skeleton resource, an animation resource, and the ability to instantiate such and drive animations.

Base class for all model nodes, which is the resource level instantiation of hierarchical model.

A skeleton resource is a container for skeletons loaded from an NSK file.

Stream loader for skeletons.

Contains relevant information about a skeleton joint.

Each node represents some level in the hierarchy, and the different type of node contain their specific data.

The nodes have names for lookup, the name is setup during load.

A node is a part of an N-tree, meaning there are N children [0-infinity] for each node. The model itself keeps track of the root node, and a dictionary of all nodes and their corresponding names.

Classes

class  CharacterContext
 Assumes control over the character animation functionalities of a model if it contains a character definition and an animation set. More...
struct  CharacterJobContext
struct  CharacterJoint
struct  Nsk3Header
 NSK3 file format structs. More...
struct  Nsk3Joint
struct  Nsk3Skeleton
struct  SkeletonCreateInfo
struct  SkeletonId
struct  SkeletonJobJoint
class  SkeletonLoader
struct  SkeletonResourceId

Typedefs

typedef Ids::IdAllocator< Util::FixedArray< CharacterJoint >, Util::FixedArray< Math::mat4 >, Util::HashTable< Util::StringAtom, IndexT >, Util::FixedArray< Math::vec4 > > SkeletonAllocator
typedef Ids::IdAllocator< Util::FixedArray< SkeletonId > > SkeletonResourceAllocator

Enumerations

enum  EnqueueMode { Append , Replace , IgnoreIfSame }
enum  { Skeleton_Joints , Skeleton_BindPose , Skeleton_JointNameMap , Skeleton_IdleSamples }

Functions

 __ImplementContext (CharacterContext, CharacterContext::characterContextAllocator)
static void FetchJointMasks (const Graphics::GraphicsEntityId id, Util::FixedArray< CoreAnimation::AnimSampleMask > &outMasks)
 Copy the joint masks of the model of a character, they're kept with the character so the clips playing with them can point to them.
void TakeOverTrack (CharacterContext::AnimationRuntime &playing, CharacterContext::AnimationRuntime &fading, CharacterContext::AnimationRuntime &next, const bool appended)
 A clip takes the track over.
void AdvanceRuntime (CharacterContext::AnimationRuntime &runtime, const Timing::Tick ticks)
 Move a clip on to the time of the update.
float FadeWeight (const CharacterContext::AnimationRuntime &runtime)
 How far a clip is faded in, and out as it ends if it isn't infinite, from 0 to 1.
const bool IsExpired (const CharacterContext::AnimationRuntime &runtime, const Timing::Time time)
const bool IsInfinite (const CharacterContext::AnimationRuntime &runtime)
Timing::Tick GetAbsoluteStopTime (const CharacterContext::AnimationRuntime &runtime)
static void CollectFiredEvents (const CoreAnimation::AnimationId anim, const IndexT clipIndex, const IndexT track, const Timing::Tick from, const Timing::Tick to, Util::Array< CharacterContext::FiredEvent > &outEvents)
 Add the events of a clip that are passed going from one sample time to a later one, the start isn't included.
static void IdleSamples (const Util::FixedArray< Math::vec4 > &idleSamples, const CoreAnimation::AnimSampleBuffer &sampleBuffer)
 Set the samples to the idle pose, a translation, rotation and scale per joint, for clips to be mixed over.
void EvalCharacter (SizeT totalJobs, SizeT groupSize, IndexT groupIndex, SizeT invocationOffset, void *ctx)
 __ImplementEnumBitOperators (CharacterContext::LoadState)
const SkeletonId CreateSkeleton (const SkeletonCreateInfo &info)
 create model (resource)
void DestroySkeleton (const SkeletonId id)
 discard model (resource)
const SizeT SkeletonGetNumJoints (const SkeletonId id)
 get number of joints from skeleton
const Util::FixedArray< CharacterJoint > & SkeletonGetJoints (const SkeletonId id)
 get joints from skeleton
const Util::FixedArray< Math::mat4 > & SkeletonGetBindPose (const SkeletonId id)
 get bind pose
const IndexT SkeletonGetJointIndex (const SkeletonId id, const Util::StringAtom &name)
 get joint index
const Util::FixedArray< Math::vec4 > & SkeletonGetIdleSamples (const SkeletonId id)
 Get idle samples.
void SkeletonEvalJob (const Jobs::JobFuncContext &ctx)
void SkeletonEvalJobWithVariation (const Jobs::JobFuncContext &ctx)
 __ImplementClass (Characters::SkeletonLoader, 'SSKP', Resources::ResourceLoader) SkeletonLoader
const SkeletonId SkeletonResourceGetSkeleton (const SkeletonResourceId id, IndexT index)
 Fetch skeleton from loaded resource.
void DestroySkeletonResource (const SkeletonResourceId id)
 Discard skeleton resource and the skeletons it holds.

Variables

SkeletonAllocator skeletonAllocator
SkeletonResourceAllocator skeletonResourceAllocator

Typedef Documentation

◆ SkeletonAllocator

◆ SkeletonResourceAllocator

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Skeleton_Joints 
Skeleton_BindPose 
Skeleton_JointNameMap 
Skeleton_IdleSamples 

◆ EnqueueMode

Enumerator
Append 
Replace 
IgnoreIfSame 

Function Documentation

◆ __ImplementClass()

Characters::__ImplementClass ( Characters::SkeletonLoader ,
'SSKP' ,
Resources::ResourceLoader  )

◆ __ImplementContext()

Characters::__ImplementContext ( CharacterContext ,
CharacterContext::characterContextAllocator  )

◆ __ImplementEnumBitOperators()

Characters::__ImplementEnumBitOperators ( CharacterContext::LoadState )

◆ AdvanceRuntime()

void Characters::AdvanceRuntime ( CharacterContext::AnimationRuntime & runtime,
const Timing::Tick ticks )

Move a clip on to the time of the update.

It starts on the first update it's in, a paused clip holds its time

◆ CollectFiredEvents()

void Characters::CollectFiredEvents ( const CoreAnimation::AnimationId anim,
const IndexT clipIndex,
const IndexT track,
const Timing::Tick from,
const Timing::Tick to,
Util::Array< CharacterContext::FiredEvent > & outEvents )
static

Add the events of a clip that are passed going from one sample time to a later one, the start isn't included.

The times go on past the clip's duration when it loops, an event is added once however often it's passed

◆ CreateSkeleton()

const SkeletonId Characters::CreateSkeleton ( const SkeletonCreateInfo & info)

create model (resource)

◆ DestroySkeleton()

void Characters::DestroySkeleton ( const SkeletonId id)

discard model (resource)

◆ DestroySkeletonResource()

void Characters::DestroySkeletonResource ( const SkeletonResourceId id)

Discard skeleton resource and the skeletons it holds.

Destroy all skeletons in resource.

◆ EvalCharacter()

void Characters::EvalCharacter ( SizeT totalJobs,
SizeT groupSize,
IndexT groupIndex,
SizeT invocationOffset,
void * ctx )

◆ FadeWeight()

float Characters::FadeWeight ( const CharacterContext::AnimationRuntime & runtime)

How far a clip is faded in, and out as it ends if it isn't infinite, from 0 to 1.

The fades go by the time since the clip started, not its own time, so they take as long whatever the clip's speed

◆ FetchJointMasks()

void Characters::FetchJointMasks ( const Graphics::GraphicsEntityId id,
Util::FixedArray< CoreAnimation::AnimSampleMask > & outMasks )
static

Copy the joint masks of the model of a character, they're kept with the character so the clips playing with them can point to them.

◆ GetAbsoluteStopTime()

Timing::Tick Characters::GetAbsoluteStopTime ( const CharacterContext::AnimationRuntime & runtime)

◆ IdleSamples()

void Characters::IdleSamples ( const Util::FixedArray< Math::vec4 > & idleSamples,
const CoreAnimation::AnimSampleBuffer & sampleBuffer )
static

Set the samples to the idle pose, a translation, rotation and scale per joint, for clips to be mixed over.

◆ IsExpired()

const bool Characters::IsExpired ( const CharacterContext::AnimationRuntime & runtime,
const Timing::Time time )

◆ IsInfinite()

const bool Characters::IsInfinite ( const CharacterContext::AnimationRuntime & runtime)

◆ SkeletonEvalJob()

void Characters::SkeletonEvalJob ( const Jobs::JobFuncContext & ctx)

◆ SkeletonEvalJobWithVariation()

void Characters::SkeletonEvalJobWithVariation ( const Jobs::JobFuncContext & ctx)

◆ SkeletonGetBindPose()

const Util::FixedArray< Math::mat4 > & Characters::SkeletonGetBindPose ( const SkeletonId id)

get bind pose

◆ SkeletonGetIdleSamples()

const Util::FixedArray< Math::vec4 > & Characters::SkeletonGetIdleSamples ( const SkeletonId id)

Get idle samples.

◆ SkeletonGetJointIndex()

const IndexT Characters::SkeletonGetJointIndex ( const SkeletonId id,
const Util::StringAtom & name )

get joint index

◆ SkeletonGetJoints()

const Util::FixedArray< CharacterJoint > & Characters::SkeletonGetJoints ( const SkeletonId id)

get joints from skeleton

◆ SkeletonGetNumJoints()

const SizeT Characters::SkeletonGetNumJoints ( const SkeletonId id)

get number of joints from skeleton

◆ SkeletonResourceGetSkeleton()

const SkeletonId Characters::SkeletonResourceGetSkeleton ( const SkeletonResourceId id,
IndexT index )

Fetch skeleton from loaded resource.

Get skeleton from resource.

◆ TakeOverTrack()

void Characters::TakeOverTrack ( CharacterContext::AnimationRuntime & playing,
CharacterContext::AnimationRuntime & fading,
CharacterContext::AnimationRuntime & next,
const bool appended )

A clip takes the track over.

The clip playing plays on under it while it fades in, a clip appended after the playing one fades in for as long as the playing one fades out if that's longer. Without a fade the clip playing is dropped, and so is one still fading from before

Variable Documentation

◆ skeletonAllocator

SkeletonAllocator Characters::skeletonAllocator

◆ skeletonResourceAllocator

SkeletonResourceAllocator Characters::skeletonResourceAllocator