Radium Engine
1.5.0
|
#include <Engine/Scene/SkeletonComponent.hpp>
Public Types | |
using | Animation = std::vector< Core::Animation::KeyFramedValue< Core::Transform > > |
Animations are lists of keyframed transforms (one per bone). | |
Public Member Functions | |
SkeletonComponent (const std::string &name, Entity *entity) | |
SkeletonComponent (const SkeletonComponent &)=delete | |
SkeletonComponent & | operator= (const SkeletonComponent &)=delete |
Component interface | |
void | initialize () override |
Pure virtual method to be overridden by any component. When this method is called you are guaranteed that all other startup systems have been loaded. | |
bool | canEdit (const Core::Utils::Index &roIdx) const override |
Returns true if a transform can be edited with the render object index given as a key. | |
Core::Transform | getTransform (const Core::Utils::Index &roIdx) const override |
Get the transform associated with the given RO index key. | |
Core::Transform | getBoneTransform (uint boneIdx, const Ra::Core::Animation::HandleArray::SpaceType MODE) |
void | setTransform (const Core::Utils::Index &roIdx, const Core::Transform &transform) override |
Set the new transform associated with the RO index key. | |
void | setBoneTransform (uint boneIdx, const Core::Transform &transform, const Ra::Core::Animation::HandleArray::SpaceType MODE) |
Build from fileData | |
void | handleSkeletonLoading (const Core::Asset::HandleData *data) |
Create the skeleton from the given data. | |
void | handleAnimationLoading (const std::vector< Core::Asset::AnimationData * > &data) |
Create the animations from the given data. | |
Skeleton-based animation data | |
const std::string & | getSkelName () const |
Returns the name of the skeleton. | |
void | setSkeleton (const Core::Animation::Skeleton &skel) |
Set the animation skeleton. | |
const Core::Animation::Skeleton * | getSkeleton () |
Returns the animation skeleton. | |
size_t | getAnimationCount () const |
Return the number of animations. | |
const Animation & | getAnimation (const size_t i) const |
Return the i -th animation. | |
Animation & | getAnimation (const size_t i) |
Return the i -th animation. | |
Animation & | addNewAnimation () |
Creates a new empty animation from the current pose. | |
void | removeAnimation (const size_t i) |
Deletes the i-th animation. | |
void | useAnimation (const size_t i) |
Set the animation to play. | |
size_t | getAnimationId () const |
Return the index of the animation to play. | |
Animation Process | |
void | update (Scalar time) |
Updates the skeleton pose as the pose corresponding to time time . | |
Scalar | getAnimationTime () const |
Returns the current time of animation. | |
std::pair< Scalar, Scalar > | getAnimationTimeInterval () const |
Returns the start and end time of the current animation. | |
void | setSpeed (const Scalar value) |
Set animation speed factor. | |
Scalar | getSpeed () const |
Return animation speed factor. | |
void | autoRepeat (const bool status) |
Toggle animation auto repeat. | |
bool | isAutoRepeat () const |
Return true is animation auto repeat is on, false otherwise. | |
void | pingPong (const bool status) |
Toggle animation ping-pong. | |
bool | isPingPong () const |
Return true is animation ping-pong is on, false otherwise. | |
Skeleton display and manipulation | |
void | setXray (bool on) const |
bool | isXray () const |
Return true if bones are displayed in xray mode, false otherwise. | |
void | toggleSkeleton (const bool status) |
Toggle skeleton bones display. | |
bool | isShowingSkeleton () const |
Return true if the skeleton is displayed. | |
const std::map< Core::Utils::Index, uint > * | getBoneRO2idx () const |
Returns the map from RO index to bone index. | |
void | updateDisplay () |
Updates the skeleton display. | |
void | setManipulationScheme (const Core::Animation::Skeleton::Manipulation &scheme) |
Sets the given manipulation scheme for the Skeleton. | |
Core::Animation::Skeleton::Manipulation | getManipulationScheme () |
Returns the manipulation scheme for the Skeleton. | |
Public Member Functions inherited from Ra::Engine::Scene::Component | |
Component (const std::string &name, Entity *entity) | |
CONSTRUCTOR. | |
virtual | ~Component () |
DESTRUCTOR. | |
virtual void | setEntity (Entity *entity) |
Set entity the component is part of. This method is called by the entity. More... | |
virtual Entity * | getEntity () const |
Return the entity the component belongs to. | |
virtual const std::string & | getName () const |
Return the component's name. | |
virtual void | setSystem (System *system) |
Set the system to which the component belongs. | |
virtual System * | getSystem () const |
Returns the system to which the component belongs. | |
Core::Utils::Index | addRenderObject (Rendering::RenderObject *renderObject) |
Add a new render object to the component. This adds the RO to the manager for drawing. | |
void | removeRenderObject (const Core::Utils::Index &roIdx) |
Remove the render object from the component. | |
void | notifyRenderObjectExpired (const Core::Utils::Index &idx) |
virtual Core::Aabb | computeAabb () |
void | invalidateAabb () |
const std::vector< Core::Utils::Index > & | getRenderObjects () |
Friends | |
class | SkeletonBasedAnimationSystem |
Additional Inherited Members | |
Public Attributes inherited from Ra::Engine::Scene::Component | |
std::vector< Core::Utils::Index > | m_renderObjects |
Static Protected Member Functions inherited from Ra::Engine::Scene::Component | |
static Rendering::RenderObjectManager * | getRoMgr () |
Shortcut to access the render object manager. | |
Protected Attributes inherited from Ra::Engine::Scene::Component | |
std::string | m_name {} |
Entity * | m_entity { nullptr } |
System * | m_system { nullptr } |
The SkeletonComponent is responsible for the management of skeleton-based character animations. It stores the animation Skeleton and the animation data and is responsible for drawing the skeleton.
Regarding Component Communication, an AnimationComponent gives access to the following data from the skeleton's name:
Definition at line 41 of file SkeletonComponent.hpp.
void Ra::Engine::Scene::SkeletonComponent::setXray | ( | bool | on | ) | const |
Turns xray display on/off for the skeleton bones.
Definition at line 243 of file SkeletonComponent.cpp.