diff --git a/include/Matrix.hpp b/include/Matrix.hpp index 7f82138d..829dba83 100644 --- a/include/Matrix.hpp +++ b/include/Matrix.hpp @@ -120,8 +120,12 @@ class Matrix : public ::Matrix { [[nodiscard]] Matrix Multiply(const ::Matrix& right) const { return ::MatrixMultiply(*this, right); } + [[nodiscard]] Matrix Multiply(float value) const { return ::MatrixMultiplyValue(*this, value); } + Matrix operator*(const ::Matrix& matrix) { return ::MatrixMultiply(*this, matrix); } + Matrix operator*(float value) { return ::MatrixMultiplyValue(*this, value); } + static Matrix Frustum(double left, double right, double bottom, double top, double near, double far) { return ::MatrixFrustum(left, right, bottom, top, near, far); } diff --git a/include/Model.hpp b/include/Model.hpp index 5e6597c0..93a1cbce 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -136,9 +136,9 @@ class Model : public ::Model { } /** - * Update model animation pose + * Blend two model animation poses */ - Model& UpdateAnimationsEx(const ::ModelAnimation& animA, float frameA, const ::ModelAnimation& animB, float frameB, float blend) { + Model& BlendAnimation(const ::ModelAnimation& animA, float frameA, const ::ModelAnimation& animB, float frameB, float blend) { ::UpdateModelAnimationEx(*this, animA, frameA, animB, frameB, blend); return *this; } diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index c5b2efd1..6cbcd6a7 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -26,8 +26,8 @@ class ModelAnimation : public ::ModelAnimation { other.keyframePoses = nullptr; } - // TODO: Implement a way to unload all animations at once, as the current Unload() only unloads one animation. - ~ModelAnimation() { Unload(1); } + // Unloads animation data using populated animCount field, which is set by Load() method. + ~ModelAnimation() { Unload(); } /** * Load model animations from file @@ -35,6 +35,7 @@ class ModelAnimation : public ::ModelAnimation { static std::vector Load(const std::string& fileName) { int count = 0; ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count); + std::vector mats(modelAnimations, modelAnimations + count); RL_FREE(modelAnimations); @@ -58,7 +59,7 @@ class ModelAnimation : public ::ModelAnimation { return *this; } - Unload(1); + Unload(); set(other); other.boneCount = 0; @@ -71,24 +72,31 @@ class ModelAnimation : public ::ModelAnimation { /** * Unload animation data */ - void Unload(int animCount) { ::UnloadModelAnimations(this, animCount); } + void Unload() { + ::UnloadModelAnimations(this, 1); + } + + static void Unload(ModelAnimation *modelAnimation, int count) { + ::UnloadModelAnimations(modelAnimation, count); + } /** * Update model animation pose */ - ModelAnimation& Update(const ::Model& model, int frame) { + ModelAnimation& Update(const ::Model& model, float frame) { ::UpdateModelAnimation(model, *this, frame); return *this; } /** - * Update model animation mesh bone matrices (GPU skinning) + * Blend two animation poses */ - ModelAnimation& UpdateBones(const ::Model& model, int frame) { - ::UpdateModelAnimation(model, *this, frame); + ModelAnimation& Blend(const ::Model& model, float frameA, const ::ModelAnimation& animB, float frameB, float blend) { + ::UpdateModelAnimationEx(model, *this, frameA, animB, frameB, blend); return *this; } + /** * Check model animation skeleton match */