Wasabi
Classes | Public Member Functions | Static Public Member Functions | List of all members
WSkeleton Class Reference

#include <WSkeletalAnimation.hpp>

Inheritance diagram for WSkeleton:
WAnimation WFileAsset WBase

Public Member Functions

 WSkeleton (Wasabi *const app, uint32_t ID=0)
 
WError CreateKeyFrame (WBone *baseBone, float fTime)
 
WError DeleteKeyFrame (uint32_t frame)
 
WBoneGetKeyFrame (uint32_t frame)
 
virtual void AddSubAnimation ()
 
void SetSubAnimationBaseBone (uint32_t subAnimation, uint32_t boneIndex, uint32_t parentSubAnimation=-1)
 
virtual void Update (float fDeltaTime)
 
virtual WImageGetTexture () const
 
virtual WBoneGetBone (uint32_t frame, uint32_t index) const
 
virtual WBoneGetBone (uint32_t frame, std::string name) const
 
void Scale (float scale)
 
void Scale (float x, float y, float z)
 
void Scale (WVector3 scale)
 
void BindToBone (WOrientation *obj, uint32_t boneID)
 
void UnbindFromBone (WOrientation *obj, uint32_t boneID)
 
void UnbindFromBone (uint32_t boneID)
 
void SetBindingScale (float scale)
 
void SetBindingScale (float x, float y, float z)
 
void SetBindingScale (WVector3 scale)
 
WVector3 GetCurrentParentBonePosition ()
 
virtual WError CopyFrom (const WAnimation *const from)
 
virtual WError UseAnimationFrames (const WAnimation *const anim)
 
bool Valid () const
 
virtual WError SaveToStream (WFile *file, std::ostream &outputStream)
 
virtual WError LoadFromStream (WFile *file, std::istream &inputStream, std::vector< void * > &args, std::string nameSuffix)
 
- Public Member Functions inherited from WAnimation
virtual std::string GetTypeName () const override
 
virtual void SetID (uint32_t newID) override
 
virtual void SetName (std::string newName) override
 
 WAnimation (class Wasabi *const app, uint32_t ID=0)
 
virtual void RemoveSubAnimation (uint32_t index)
 
WError SetKeyFrameTime (uint32_t frame, float fTime)
 
void SetPlaySpeed (float fSpeedMultiplier, uint32_t subAnimation=-1)
 
void SetCurrentFrame (uint32_t frame, uint32_t subAnimation=0)
 
void SetCurrentTime (float fTime, uint32_t subAnimation=0)
 
void SetPlayingBounds (uint32_t startFrame, uint32_t endFrame, uint32_t subAnimation=0)
 
void SetPlayingBounds_Time (float fStartTime, float fEndTime, uint32_t subAnimation=0)
 
void Play (uint32_t subAnimation=-1)
 
void Loop (uint32_t subAnimation=-1)
 
void Stop (uint32_t subAnimation=-1)
 
void Reset (uint32_t subAnimation=-1)
 
bool Playing (uint32_t subAnimation=0) const
 
bool Looping (uint32_t subAnimation=0) const
 
float GetTime (uint32_t subAnimation=0) const
 
- Public Member Functions inherited from WFileAsset
 WFileAsset (class Wasabi *const app, uint32_t ID=0)
 
virtual WError LoadFromStream (class WFile *file, std::istream &inputStream, vector< void * > &args, std::string nameSuffix)=0
 
- Public Member Functions inherited from WBase
 WBase (class Wasabi *const app, uint32_t ID=0)
 
uint32_t GetID () const
 
std::string GetName () const
 
class WasabiGetAppPtr () const
 
void AddReference ()
 
void RemoveReference ()
 

Static Public Member Functions

static std::vector< void * > LoadArgs ()
 
- Static Public Member Functions inherited from WAnimation
static std::string _GetTypeName ()
 

Additional Inherited Members

- Protected Member Functions inherited from WAnimation
void m_UpdateFirstFrame (uint32_t subAnimation=-1)
 
- Protected Attributes inherited from WAnimation
bool m_bFramesOwner
 
float m_totalTime
 
vector< W_FRAME * > m_frames
 
vector< W_SUB_ANIMATION * > m_subAnimations
 
- Protected Attributes inherited from WBase
class Wasabim_app
 
uint32_t m_ID
 
std::string m_name
 

Detailed Description

This is the class implementing skeletal animation, as described in WSkeletalAnimation.h.

Member Function Documentation

◆ AddSubAnimation()

virtual void WSkeleton::AddSubAnimation ( )
virtual

Appends a subanimation to this animation. This is inherited from WAnimation.

Reimplemented from WAnimation.

◆ BindToBone()

void WSkeleton::BindToBone ( WOrientation obj,
uint32_t  boneID 
)

Binds any orientation-enabled entity (WObject, WLight, etc...) to a bone in the skeleton. The user MUST ensure that the bound object remains valid while it is bound to a skeleton.

Parameters
objPointer to the object to bind
boneIDIndex of the bone to bind obj to

◆ CopyFrom()

virtual WError WSkeleton::CopyFrom ( const WAnimation *const  from)
virtual

Copies another WSkeleton.

Parameters
fromSekelton to copy from
Returns
Error code, see WError.h

Implements WAnimation.

◆ CreateKeyFrame()

WError WSkeleton::CreateKeyFrame ( WBone baseBone,
float  fTime 
)

Appends a keyframe to the frames of this animation.

Parameters
baseBoneThe root of the bone structure for this keyframe
fTimeThe duration of this keyframe
Returns
Error code, see WError.h

◆ DeleteKeyFrame()

WError WSkeleton::DeleteKeyFrame ( uint32_t  frame)

Delete a an existing keyframe.

Parameters
frameIndex of the keyframe to delete
Returns
Error code, see WError.h

◆ GetBone() [1/2]

virtual WBone* WSkeleton::GetBone ( uint32_t  frame,
std::string  name 
) const
virtual

Retrieves a pointer to a bone from a frame. Changing the returned bone will impact the frame in real-time without any re-initialization.

Parameters
frameFrame to retrieve from
indexName of the bone to retrieve
Returns
A pointer to the retrieved bone, nullptr if it doesnt exist

◆ GetBone() [2/2]

virtual WBone* WSkeleton::GetBone ( uint32_t  frame,
uint32_t  index 
) const
virtual

Retrieves a pointer to a bone from a frame. Changing the returned bone will impact the frame in real-time without any re-initialization.

Parameters
frameFrame to retrieve from
indexIndex of the bone to retrieve
Returns
A pointer to the retrieved bone, nullptr if it doesnt exist

◆ GetCurrentParentBonePosition()

WVector3 WSkeleton::GetCurrentParentBonePosition ( )

Retrieves the world-space position of the root of this skeleton at this point in the animation.

Returns
A 3D point whee the skeleton is rooted at this time

◆ GetKeyFrame()

WBone* WSkeleton::GetKeyFrame ( uint32_t  frame)

Retrieves an existing keyframe.

Parameters
frameIndex of the keyframe to retrieve
Returns
The root of the bone structure of thi keyframe

◆ GetTexture()

virtual WImage* WSkeleton::GetTexture ( ) const
virtual

Retrieves the animation texture, as described in WSkeletalAnimation.h

Returns
The animation texture

Implements WAnimation.

◆ Scale() [1/3]

void WSkeleton::Scale ( float  scale)

Sets the scale of the the skeleton.

Parameters
scaleScale multiplier

◆ Scale() [2/3]

void WSkeleton::Scale ( float  x,
float  y,
float  z 
)

Sets the scale of the the skeleton.

Parameters
xScale multiplier on X
yScale multiplier on Y
zScale multiplier on Z

◆ Scale() [3/3]

void WSkeleton::Scale ( WVector3  scale)

Scales the skeleton.

Parameters
scaleScale multiplier components

◆ SetBindingScale() [1/3]

void WSkeleton::SetBindingScale ( float  scale)

Set the binding scale, which is applied to the binding matrix before it is set on bound objects.

Parameters
scaleScale multiplier

◆ SetBindingScale() [2/3]

void WSkeleton::SetBindingScale ( float  x,
float  y,
float  z 
)

Set the binding scale, which is applied to the binding matrix before it is set on bound objects.

Parameters
xScale multiplier on X
yScale multiplier on Y
zScale multiplier on Z

◆ SetBindingScale() [3/3]

void WSkeleton::SetBindingScale ( WVector3  scale)

Set the binding scale, which is applied to the binding matrix before it is set on bound objects.

Parameters
scaleScale multiplier components

◆ SetSubAnimationBaseBone()

void WSkeleton::SetSubAnimationBaseBone ( uint32_t  subAnimation,
uint32_t  boneIndex,
uint32_t  parentSubAnimation = -1 
)

Sets the base bone for a subanimation. A subanimation's transformations will affect its base bone and all its children. If a parent subanimation is present, then this subanimation will be affected by the motion of that parent subanimation.

Parameters
subAnimationThe subanimation to set its base bane
boneIndexThe index of the bone to be set as base
parentSubAnimationThe parent subanimation, -1 if none

◆ UnbindFromBone() [1/2]

void WSkeleton::UnbindFromBone ( uint32_t  boneID)

Unbind all objects from a bone.

Parameters
boneIDIndex of the bone to unbind objects from

◆ UnbindFromBone() [2/2]

void WSkeleton::UnbindFromBone ( WOrientation obj,
uint32_t  boneID 
)

Unbind an object from a bone.

Parameters
objPointer to the object to unbind
boneIDIndex of the bone to unbind obj from

◆ Update()

virtual void WSkeleton::Update ( float  fDeltaTime)
virtual

Steps the state of the playing (or looping) subanimations forward. This is usually called by the engine during normal execution each frame.

Parameters
fDeltaTimestep time in seconds

Reimplemented from WAnimation.

◆ UseAnimationFrames()

virtual WError WSkeleton::UseAnimationFrames ( const WAnimation *const  anim)
virtual

Use the animation frames of another animation object. This is more efficient than copying in time and memory usage.

Parameters
animAnimation to use its frames
Returns
Error code, see WError.h

Implements WAnimation.

◆ Valid()

bool WSkeleton::Valid ( ) const
virtual

Returns whether or not this skeleton is valid. A valid skeleton is one that has animation keyframes and a bone texture.

Returns
true if the skeleton is valid, false otherwise

Implements WBase.


The documentation for this class was generated from the following file: