3 #include <Core/Animation/HandleWeight.hpp>
4 #include <Core/Animation/KeyFramedValue.hpp>
5 #include <Core/Animation/Skeleton.hpp>
6 #include <Core/Asset/AnimationData.hpp>
7 #include <Core/Asset/HandleData.hpp>
9 #include <Engine/Scene/Component.hpp>
14 class BlinnPhongMaterial;
19 class RenderTechnique;
24 class SkeletonBasedAnimationSystem;
47 using Animation = std::vector<Core::Animation::KeyFramedValue<Core::Transform>>;
59 bool canEdit(
const Core::Utils::Index& roIdx )
const override;
61 Core::Transform getTransform(
const Core::Utils::Index& roIdx )
const override;
62 Core::Transform getBoneTransform( uint boneIdx,
65 void setTransform(
const Core::Utils::Index& roIdx,
const Core::Transform& transform )
override;
66 void setBoneTransform( uint boneIdx,
67 const Core::Transform& transform,
78 void handleAnimationLoading(
const std::vector<Core::Asset::AnimationData*>& data );
85 inline const std::string&
getSkelName()
const {
return m_skelName; }
103 Animation& addNewAnimation();
106 void removeAnimation(
const size_t i );
109 void useAnimation(
const size_t i );
112 size_t getAnimationId()
const;
119 void update( Scalar time );
122 Scalar getAnimationTime()
const;
125 std::pair<Scalar, Scalar> getAnimationTimeInterval()
const;
128 void setSpeed(
const Scalar value );
131 Scalar getSpeed()
const;
134 void autoRepeat(
const bool status );
137 bool isAutoRepeat()
const;
140 void pingPong(
const bool status );
143 bool isPingPong()
const;
151 void setXray(
bool on )
const;
157 void toggleSkeleton(
const bool status );
160 bool isShowingSkeleton()
const;
163 const std::map<Core::Utils::Index, uint>* getBoneRO2idx()
const;
166 void updateDisplay();
177 void setupSkeletonDisplay();
189 const Core::Animation::RefPose* getRefPoseOutput()
const;
192 const Animation* getAnimationOutput()
const;
195 const Scalar* getTimeOutput()
const;
198 const bool* getWasReset()
const;
203 std::string m_skelName;
209 Core::Animation::RefPose m_refPose;
212 std::vector<Animation> m_animations;
215 size_t m_animationID { 0 };
218 Scalar m_animationTime { 0_ra };
221 Scalar m_speed { 1_ra };
224 bool m_autoRepeat {
false };
227 bool m_pingPong {
false };
230 bool m_wasReset {
false };
233 std::vector<Rendering::RenderObject*> m_boneDrawables;
236 std::map<Core::Utils::Index, uint> m_boneMap;
239 static std::shared_ptr<Data::Mesh> s_boneMesh;
242 static std::shared_ptr<Data::BlinnPhongMaterial> s_boneMaterial;
245 static std::shared_ptr<Rendering::RenderTechnique> s_boneRenderTechnique;
A component is an element that can be updated by a system. It is also linked to some other components...
An entity is an scene element. It ties together components with a transform.
size_t getAnimationCount() const
Return the number of animations.
Animation & getAnimation(const size_t i)
Return the i -th animation.
void initialize() override
Pure virtual method to be overridden by any component. When this method is called you are guaranteed ...
const std::string & getSkelName() const
Returns the name of the skeleton.
std::vector< Core::Animation::KeyFramedValue< Core::Transform > > Animation
Animations are lists of keyframed transforms (one per bone).
const Animation & getAnimation(const size_t i) const
Return the i -th animation.
const Core::Animation::Skeleton * getSkeleton()
Returns the animation skeleton.