From bd637c295469be81af7234fb43fa3a3b70c9b702 Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Sun, 1 Mar 2026 20:40:33 +0530 Subject: [PATCH 1/8] Fixed references to boneCount, bones, bindPose to reflect access to ModelSkeleton struct in raylib v6 --- .gitignore | 1 + include/Model.hpp | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index dfcbe19a..c8e7988f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules cmake-build-debug .idea docs +/.vs diff --git a/include/Model.hpp b/include/Model.hpp index c8c65af5..f8132120 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -58,9 +58,14 @@ class Model : public ::Model { other.meshes = nullptr; other.materials = nullptr; other.meshMaterial = nullptr; - other.boneCount = 0; - other.bones = nullptr; - other.bindPose = nullptr; + + /* + The Animation Data is now stored within a separate struct called + `ModelSkeleton`. The changes below reflect this update. + */ + other.skeleton.boneCount = 0; + other.skeleton.bones = nullptr; + other.skeleton.bindPose = nullptr; } GETTERSETTER(::Matrix, Transform, transform) @@ -69,9 +74,9 @@ class Model : public ::Model { GETTERSETTER(::Mesh*, Meshes, meshes) GETTERSETTER(::Material*, Materials, materials) GETTERSETTER(int*, MeshMaterial, meshMaterial) - GETTERSETTER(int, BoneCount, boneCount) - GETTERSETTER(::BoneInfo*, Bones, bones) - GETTERSETTER(::Transform*, BindPose, bindPose) + GETTERSETTER(int, BoneCount, skeleton.boneCount) + GETTERSETTER(::BoneInfo*, Bones, skeleton.bones) + GETTERSETTER(::Transform*, BindPose, skeleton.bindPose) Model& operator=(const ::Model& model) { set(model); @@ -93,9 +98,9 @@ class Model : public ::Model { other.meshes = nullptr; other.materials = nullptr; other.meshMaterial = nullptr; - other.boneCount = 0; - other.bones = nullptr; - other.bindPose = nullptr; + other.skeleton.boneCount = 0; + other.skeleton.bones = nullptr; + other.skeleton.bindPose = nullptr; return *this; } @@ -240,9 +245,9 @@ class Model : public ::Model { materials = model.materials; meshMaterial = model.meshMaterial; - boneCount = model.boneCount; - bones = model.bones; - bindPose = model.bindPose; + skeleton.boneCount = model.skeleton.boneCount; + skeleton.bones = model.skeleton.bones; + skeleton.bindPose = model.skeleton.bindPose; } }; From 2bbd53de3b8875f5cea85623b603adee080c6211 Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 17:42:05 +0530 Subject: [PATCH 2/8] Updated method UpdateModelAnimationBones() to UpdateModelAnimationEx() with correct datatype --- include/Model.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Model.hpp b/include/Model.hpp index f8132120..5ba30cf5 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -127,7 +127,7 @@ class Model : public ::Model { /** * Update model animation pose */ - Model& UpdateAnimation(const ::ModelAnimation& anim, int frame) { + Model& UpdateAnimation(const ::ModelAnimation& anim, float frame) { ::UpdateModelAnimation(*this, anim, frame); return *this; } @@ -135,8 +135,8 @@ class Model : public ::Model { /** * Update model animation pose */ - Model& UpdateAnimationBones(const ::ModelAnimation& anim, int frame) { - ::UpdateModelAnimationBones(*this, anim, frame); + Model& UpdateAnimationsEx(const ::ModelAnimation& animA, float frameA, const ::ModelAnimation& animB, float frameB, float blend) { + ::UpdateModelAnimationEx(*this, animA, frameA, animB, frameB, blend); return *this; } From 9ce142d541a018b2cbe516edacb996079cd99fde Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 18:01:12 +0530 Subject: [PATCH 3/8] Updated boneId to boneIndices, relocated boneMatrices from Mesh to Model, added currentPose --- include/MeshUnmanaged.hpp | 8 +++----- include/Model.hpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/MeshUnmanaged.hpp b/include/MeshUnmanaged.hpp index 386ae2a4..8aaa1d6e 100644 --- a/include/MeshUnmanaged.hpp +++ b/include/MeshUnmanaged.hpp @@ -35,9 +35,8 @@ class MeshUnmanaged : public ::Mesh { indices = nullptr; animVertices = nullptr; animNormals = nullptr; - boneIds = nullptr; + boneIndices = nullptr; boneWeights = nullptr; - boneMatrices = nullptr; boneCount = 0; vaoId = 0; vboId = nullptr; @@ -130,7 +129,7 @@ class MeshUnmanaged : public ::Mesh { GETTERSETTER(unsigned short*, Indices, indices) // NOLINT GETTERSETTER(float*, AnimVertices, animVertices) GETTERSETTER(float*, AnimNormals, animNormals) - GETTERSETTER(unsigned char*, BoneIds, boneIds) + GETTERSETTER(unsigned char*, BoneIndices, boneIndices) GETTERSETTER(float*, BoneWeights, boneWeights) GETTERSETTER(unsigned int, VaoId, vaoId) GETTERSETTER(unsigned int*, VboId, vboId) @@ -242,9 +241,8 @@ class MeshUnmanaged : public ::Mesh { indices = mesh.indices; animVertices = mesh.animVertices; animNormals = mesh.animNormals; - boneIds = mesh.boneIds; + boneIndices = mesh.boneIndices; boneWeights = mesh.boneWeights; - boneMatrices = mesh.boneMatrices; vaoId = mesh.vaoId; vboId = mesh.vboId; } diff --git a/include/Model.hpp b/include/Model.hpp index 5ba30cf5..5e6597c0 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -59,13 +59,12 @@ class Model : public ::Model { other.materials = nullptr; other.meshMaterial = nullptr; - /* - The Animation Data is now stored within a separate struct called - `ModelSkeleton`. The changes below reflect this update. - */ other.skeleton.boneCount = 0; other.skeleton.bones = nullptr; other.skeleton.bindPose = nullptr; + + ModelAnimPose currentPose; + Matrix *boneMatrices; } GETTERSETTER(::Matrix, Transform, transform) @@ -77,6 +76,8 @@ class Model : public ::Model { GETTERSETTER(int, BoneCount, skeleton.boneCount) GETTERSETTER(::BoneInfo*, Bones, skeleton.bones) GETTERSETTER(::Transform*, BindPose, skeleton.bindPose) + GETTERSETTER(::ModelAnimPose, CurrentPose, currentPose) + GETTERSETTER(::Matrix*, BoneMatrices, boneMatrices) Model& operator=(const ::Model& model) { set(model); @@ -101,6 +102,8 @@ class Model : public ::Model { other.skeleton.boneCount = 0; other.skeleton.bones = nullptr; other.skeleton.bindPose = nullptr; + other.currentPose = nullptr; + other.boneMatrices = nullptr; return *this; } @@ -248,6 +251,8 @@ class Model : public ::Model { skeleton.boneCount = model.skeleton.boneCount; skeleton.bones = model.skeleton.bones; skeleton.bindPose = model.skeleton.bindPose; + currentPose = model.currentPose; + boneMatrices = model.boneMatrices; } }; From 17494404818be1df836f1b3a3e4c0c72259546bc Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 18:11:23 +0530 Subject: [PATCH 4/8] Updated boneId to boneIndices in Mesh.hpp --- include/Mesh.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Mesh.hpp b/include/Mesh.hpp index ff960406..29182350 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -48,7 +48,7 @@ class Mesh : public MeshUnmanaged { other.indices = nullptr; other.animVertices = nullptr; other.animNormals = nullptr; - other.boneIds = nullptr; + other.boneIndices = nullptr; other.boneWeights = nullptr; other.vaoId = 0; other.vboId = nullptr; @@ -73,7 +73,7 @@ class Mesh : public MeshUnmanaged { other.indices = nullptr; other.animVertices = nullptr; other.animNormals = nullptr; - other.boneIds = nullptr; + other.boneIndices = nullptr; other.boneWeights = nullptr; other.vaoId = 0; other.vboId = nullptr; From a417182fa2c9505cbeb89e6367e638e67554e0bc Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 18:25:26 +0530 Subject: [PATCH 5/8] Updated ModelAnimation frameCount and framePoses to keyframeCount and keyframePoses. Removed redundant BoneInfo. --- include/ModelAnimation.hpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index f747244e..ec9111ee 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -22,9 +22,8 @@ class ModelAnimation : public ::ModelAnimation { set(other); other.boneCount = 0; - other.frameCount = 0; - other.bones = nullptr; - other.framePoses = nullptr; + other.keyframeCount = 0; + other.keyframePoses = nullptr; } ~ModelAnimation() { Unload(); } @@ -43,9 +42,8 @@ class ModelAnimation : public ::ModelAnimation { } GETTERSETTER(int, BoneCount, boneCount) - GETTERSETTER(::BoneInfo*, Bones, bones) - GETTERSETTER(int, FrameCount, frameCount) - GETTERSETTER(::Transform**, FramePoses, framePoses) + GETTERSETTER(int, KeyframeCount, keyframeCount) + GETTERSETTER(::Transform**, KeyframePoses, keyframePoses) ModelAnimation& operator=(const ::ModelAnimation& model) { set(model); @@ -63,9 +61,8 @@ class ModelAnimation : public ::ModelAnimation { set(other); other.boneCount = 0; - other.frameCount = 0; - other.bones = nullptr; - other.framePoses = nullptr; + other.keyframeCount = 0; + other.keyframePoses = nullptr; return *this; } @@ -98,9 +95,8 @@ class ModelAnimation : public ::ModelAnimation { protected: void set(const ::ModelAnimation& model) { boneCount = model.boneCount; - frameCount = model.frameCount; - bones = model.bones; - framePoses = model.framePoses; + keyframeCount = model.keyframeCount; + keyframePoses = model.keyframePoses; // Duplicate the name. TextCopy() uses the null terminator, which we ignore here. for (int i = 0; i < 32; i++) { From ad071979fa41c178812158ee1d246da7c2b6e35c Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 22:14:33 +0530 Subject: [PATCH 6/8] Fixed UnloadModelAnimation() to use a count --- include/ModelAnimation.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index ec9111ee..c824995e 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -26,7 +26,8 @@ class ModelAnimation : public ::ModelAnimation { other.keyframePoses = nullptr; } - ~ModelAnimation() { Unload(); } + // TODO: Implement a way to unload all animations at once, as the current Unload() only unloads one animation. + ~ModelAnimation() { Unload(1); } /** * Load model animations from file @@ -57,7 +58,7 @@ class ModelAnimation : public ::ModelAnimation { return *this; } - Unload(); + Unload(1); set(other); other.boneCount = 0; @@ -70,7 +71,7 @@ class ModelAnimation : public ::ModelAnimation { /** * Unload animation data */ - void Unload() { ::UnloadModelAnimation(*this); } + void Unload(int animCount) { ::UnloadModelAnimation(this, animCount); } /** * Update model animation pose From fd98a5ece187e9f339c655ed9fc4ec659e473d3e Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 22:17:52 +0530 Subject: [PATCH 7/8] Fixed UpdateBones() to use UpdateModelAnimationsEx() instead --- include/ModelAnimation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index c824995e..20697525 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -84,8 +84,8 @@ class ModelAnimation : public ::ModelAnimation { /** * Update model animation mesh bone matrices (GPU skinning) */ - ModelAnimation& UpdateBones(const ::Model& model, int frame) { - ::UpdateModelAnimationBones(model, *this, frame); + ModelAnimation& UpdateBones(const ::Model& animA, float frameA, const ::Model& animB, float frameB, float blend) { + ::UpdateModelAnimationEx(*this, animA, frameA, animB, frameB, blend); return *this; } From 4e3a5ea5f330a42b11faabcde1178b0feddeed44 Mon Sep 17 00:00:00 2001 From: execphantasmagoria Date: Tue, 3 Mar 2026 22:26:24 +0530 Subject: [PATCH 8/8] Fixed: Reverted UpdateModelAnimationEx() to UpdateModelAnimation(). Corrected typos --- include/ModelAnimation.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index 20697525..c5b2efd1 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -71,7 +71,7 @@ class ModelAnimation : public ::ModelAnimation { /** * Unload animation data */ - void Unload(int animCount) { ::UnloadModelAnimation(this, animCount); } + void Unload(int animCount) { ::UnloadModelAnimations(this, animCount); } /** * Update model animation pose @@ -84,8 +84,8 @@ class ModelAnimation : public ::ModelAnimation { /** * Update model animation mesh bone matrices (GPU skinning) */ - ModelAnimation& UpdateBones(const ::Model& animA, float frameA, const ::Model& animB, float frameB, float blend) { - ::UpdateModelAnimationEx(*this, animA, frameA, animB, frameB, blend); + ModelAnimation& UpdateBones(const ::Model& model, int frame) { + ::UpdateModelAnimation(model, *this, frame); return *this; }