raylib-cpp
C++ object-oriented wrapper library for raylib.
ModelAnimation.hpp
1 #ifndef RAYLIB_CPP_INCLUDE_MODELANIMATION_HPP_
2 #define RAYLIB_CPP_INCLUDE_MODELANIMATION_HPP_
3 
4 #include <vector>
5 #include <string>
6 
7 #include "./raylib.hpp"
8 #include "./raylib-cpp-utils.hpp"
9 #include "./Mesh.hpp"
10 
11 namespace raylib {
16  public:
17  ModelAnimation(const ::ModelAnimation& model) {
18  set(model);
19  }
20 
21  ~ModelAnimation() {
22  Unload();
23  }
24 
28  static std::vector<ModelAnimation> Load(const std::string& fileName) {
29  int count = 0;
30  ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count);
31  return std::vector<ModelAnimation>(modelAnimations, modelAnimations + count);
32  }
33 
34  GETTERSETTER(int, BoneCount, boneCount)
35  GETTERSETTER(::BoneInfo*, Bones, bones)
36  GETTERSETTER(int, FrameCount, frameCount)
37  GETTERSETTER(::Transform**, FramePoses, framePoses)
38 
39  ModelAnimation& operator=(const ::ModelAnimation& model) {
40  set(model);
41  return *this;
42  }
43 
47  inline void Unload() {
48  ::UnloadModelAnimation(*this);
49  }
50 
54  inline ModelAnimation& Update(const ::Model& model, int frame) {
55  ::UpdateModelAnimation(model, *this, frame);
56  return *this;
57  }
58 
62  inline bool IsValid(const ::Model& model) const {
63  return ::IsModelAnimationValid(model, *this);
64  }
65 
66  private:
67  inline void set(const ::ModelAnimation& model) {
68  boneCount = model.boneCount;
69  bones = model.bones;
70  frameCount = model.frameCount;
71  framePoses = model.framePoses;
72  }
73 };
74 } // namespace raylib
75 
76 #endif // RAYLIB_CPP_INCLUDE_MODELANIMATION_HPP_
raylib
All raylib-cpp classes and functions appear in the raylib namespace.
Definition: AudioDevice.hpp:7
raylib::ModelAnimation::Update
ModelAnimation & Update(const ::Model &model, int frame)
Update model animation pose.
Definition: ModelAnimation.hpp:54
raylib::ModelAnimation::Load
static std::vector< ModelAnimation > Load(const std::string &fileName)
Load model animations from file.
Definition: ModelAnimation.hpp:28
raylib::ModelAnimation::Unload
void Unload()
Unload animation data.
Definition: ModelAnimation.hpp:47
raylib::ModelAnimation::IsValid
bool IsValid(const ::Model &model) const
Check model animation skeleton match.
Definition: ModelAnimation.hpp:62
raylib::ModelAnimation
Model animation.
Definition: ModelAnimation.hpp:15