3 #include "Animation.hpp"
4 #include "GameObject.hpp"
5 #include "CubeCoords.hpp"
32 using ComponentPtr_t = ::covellite::api::Component::ComponentPtr_t;
34 ::std::function<Object_t(
const Material_t::value_type &)>;
40 cbMaterial_t Material;
42 ComponentPtr_t pAnimation;
46 Objects_t
GetObject(
const Any_t &)
const override;
55 float m_TicksPerSecond = 1.0f;
59 explicit Animation(
const Path_t &);
63 public GameObject::Mesh
68 using WeightBones_t = ::std::vector<::std::pair<Bone_t::Index_t, float>>;
69 using BoneTransforms_t = ::std::map<String_t, ::glm::mat4>;
71 class TriangleWeightBones final
74 WeightBones_t WeightBones[3];
81 const ::std::string & _BoneName,
82 const ::std::string & _ParentBoneName,
83 const ::glm::mat4 & _GlobalTransformation,
84 const ::glm::mat4 & _LocalTransformation)
89 GetBoneIndex(_ParentBoneName),
90 _GlobalTransformation,
95 inline const Skeleton_t & GetBones(
void)
const {
return m_Bones; }
97 inline Bone_t::Index_t GetBoneIndex(const ::std::string & _Name)
const
99 for (::std::size_t i = 0; i < m_Bones.size(); i++)
101 if (m_Bones[i].Name == _Name)
return i;
104 return Bone_t::iNonexistent;
112 Object_t
GetObject(
const Any_t &)
const override;
115 Object_t GetHoldInHandObject(
const String_t &)
const;
116 void Add(
const Triangle_t &,
const TriangleWeightBones &);
117 void AddSkin(
const Vertex &, const ::std::size_t,
const WeightBones_t &);
118 ::std::size_t GetSkinVertexCount(
void)
const {
return m_SkinVertexes.size(); }
121 mutable ::std::shared_ptr<Animations> m_pAnimations;
124 mutable Component_t::ComponentPtr_t m_pSkinData;
125 mutable Component_t::ComponentPtr_t m_pTransformBones;
128 explicit Mesh(
const Path_t &);
132 static Object_t GetCameraObject(
const GameScenePtr_t &);
133 static Object_t GetLightsObject(
void);
134 static Object_t GetPresentObject(
const CubeCoords &,
135 const ::std::vector<Index_t> &);
138 const GameScenePtr_t m_pGameScene;
140 mutable ::std::map<::std::string, ::std::size_t> m_Textures;
143 explicit Animated(
const GameScenePtr_t &);