* Model animation */
| 13 | * Model animation |
| 14 | */ |
| 15 | class ModelAnimation : public ::ModelAnimation { |
| 16 | public: |
| 17 | ModelAnimation(const ::ModelAnimation& model) { set(model); } |
| 18 | |
| 19 | ModelAnimation(const ModelAnimation&) = delete; |
| 20 | |
| 21 | ModelAnimation(ModelAnimation&& other) noexcept { |
| 22 | set(other); |
| 23 | |
| 24 | other.boneCount = 0; |
| 25 | other.keyframeCount = 0; |
| 26 | other.keyframePoses = nullptr; |
| 27 | } |
| 28 | |
| 29 | // Unloads animation data using populated animCount field, which is set by Load() method. |
| 30 | ~ModelAnimation() { Unload(); } |
| 31 | |
| 32 | /** |
| 33 | * Load model animations from file |
| 34 | */ |
| 35 | static std::vector<ModelAnimation> Load(const std::string& fileName) { |
| 36 | int count = 0; |
| 37 | ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count); |
| 38 | |
| 39 | std::vector<ModelAnimation> mats(modelAnimations, modelAnimations + count); |
| 40 | |
| 41 | RL_FREE(modelAnimations); |
| 42 | |
| 43 | return mats; |
| 44 | } |
| 45 | |
| 46 | GETTERSETTER(int, BoneCount, boneCount) |
| 47 | GETTERSETTER(int, KeyframeCount, keyframeCount) |
| 48 | GETTERSETTER(::Transform**, KeyframePoses, keyframePoses) |
| 49 | |
| 50 | ModelAnimation& operator=(const ::ModelAnimation& model) { |
| 51 | set(model); |
| 52 | return *this; |
| 53 | } |
| 54 | |
| 55 | ModelAnimation& operator=(const ModelAnimation&) = delete; |
| 56 | |
| 57 | ModelAnimation& operator=(ModelAnimation&& other) noexcept { |
| 58 | if (this == &other) { |
| 59 | return *this; |
| 60 | } |
| 61 | |
| 62 | Unload(); |
| 63 | set(other); |
| 64 | |
| 65 | other.boneCount = 0; |
| 66 | other.keyframeCount = 0; |
| 67 | other.keyframePoses = nullptr; |
| 68 | |
| 69 | return *this; |
| 70 | } |
| 71 | |
| 72 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected