Wasabi
Public Member Functions | List of all members
WBone Class Reference

#include <WSkeletalAnimation.hpp>

Inheritance diagram for WBone:
WOrientation

Public Member Functions

uint32_t GetIndex () const
 
void SetIndex (uint32_t index)
 
void GetName (char *name, uint32_t maxChars) const
 
void SetName (std::string name)
 
WBoneGetParent () const
 
void SetParent (WBone *parent)
 
uint32_t GetNumChildren () const
 
WBoneGetChild (uint32_t index) const
 
WBoneGetChild (std::string name) const
 
void AddChild (WBone *child)
 
void ClearChildren ()
 
void SetInvBindingPose (WMatrix mtx)
 
void Scale (float x, float y, float z)
 
void Scale (WVector3 scale)
 
WVector3 GetScale () const
 
WMatrix GetMatrix ()
 
WMatrix GetRelativeMatrix ()
 
WMatrix GetInvBindingPose () const
 
bool UpdateLocals ()
 
void OnStateChange (STATE_CHANGE_TYPE type)
 
WError Load (std::istream &inputStream)
 
WError Save (std::ostream &outputStream) const
 
- Public Member Functions inherited from WOrientation
void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 

Detailed Description

This class represents a single bone in a skeleton. The final matrix of this bone is calculated by GetInvBindingPose() * GetRelativeMatrix().

Member Function Documentation

◆ AddChild()

void WBone::AddChild ( WBone child)

Adds a child to this bone.

Parameters
childPointer to the new child

◆ ClearChildren()

void WBone::ClearChildren ( )

Clears all children of this bone.

◆ GetChild() [1/2]

WBone* WBone::GetChild ( std::string  name) const

Retrieves a child by name.

Parameters
nameName of the child to retrieve
Returns
The child with the name name, or nullptr if it is invalid

◆ GetChild() [2/2]

WBone* WBone::GetChild ( uint32_t  index) const

Retrieve a pointer to the child with the given index.

Parameters
indexIndex of the child
Returns
The child at index, or nullptr if index is invalid

◆ GetIndex()

uint32_t WBone::GetIndex ( ) const

Retrieves the index of this bone.

Returns
Index of this bone

◆ GetInvBindingPose()

WMatrix WBone::GetInvBindingPose ( ) const

Retrieves the inverse binding pose for this bone.

Returns
The inverse binding pose matrix.

◆ GetMatrix()

WMatrix WBone::GetMatrix ( )

Retrieves the local matrix of this bone.

Returns
Local matrix of this bone

◆ GetName()

void WBone::GetName ( char *  name,
uint32_t  maxChars 
) const

Retrieves the name of this bone.

Parameters
nameA character array to be filled with the name
maxCharsMaximum number of characters to fill in name

◆ GetNumChildren()

uint32_t WBone::GetNumChildren ( ) const

Retrieves the number of children this bone has.

Returns
Number of children for this bone

◆ GetParent()

WBone* WBone::GetParent ( ) const

Retrieves a pointer to the parent of this bone.

Returns
Parent of this bone

◆ GetRelativeMatrix()

WMatrix WBone::GetRelativeMatrix ( )

Retrieves the local matrix of this bone multiplied by the relative matrix of the parent bone (will recursively produce the final matrix for this bone).

Returns
Relative (final) matrix of this bone.

◆ GetScale()

WVector3 WBone::GetScale ( ) const

Retrieves the scale of this bone.

Returns
A 3D vector representing the scale components

◆ Load()

WError WBone::Load ( std::istream &  inputStream)

Load this bone from a file stream as a bone format.

Parameters
inputStreamStream to read the data from
Returns
Error code, see WError.h

◆ OnStateChange()

void WBone::OnStateChange ( STATE_CHANGE_TYPE  type)
virtual

This is a callback (inherited from WOrientation) to inform this object of a change in orientation.

Parameters
typeOrientation change type (rotation or motion)

Reimplemented from WOrientation.

◆ Save()

WError WBone::Save ( std::ostream &  outputStream) const

Save this bone to a file stream as a bone format.

Parameters
outputStreamStream to read the data from
Returns
Error code, see WError.h

◆ Scale() [1/2]

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

Sets the scale of this bone.

Parameters
xScale x multiplier
yScale y multiplier
zScale z multiplier

◆ Scale() [2/2]

void WBone::Scale ( WVector3  scale)

Sets the scale of this bone.

Parameters
scaleA 3D vector representing the scale components

◆ SetIndex()

void WBone::SetIndex ( uint32_t  index)

Sets the index of this bone.

Parameters
Indexnew index

◆ SetInvBindingPose()

void WBone::SetInvBindingPose ( WMatrix  mtx)

Sets the inverse matrix of the binding pose for this bone.

Parameters
mtxInverse binding pose matrix

◆ SetName()

void WBone::SetName ( std::string  name)

Sets the name of this bone.

Parameters
nameNew name

◆ SetParent()

void WBone::SetParent ( WBone parent)

Sets the parent of this bone.

Parameters
Parentpointer to the new parent

◆ UpdateLocals()

bool WBone::UpdateLocals ( )

Updates the local matrix of this bone. This function should only be called by WSkeleton.

Returns
true if the local matrix has changed, false if not.

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