Skip to content

[Fixes #381] Replaces GPU Skinning for Animation Blending#380

Open
execphantasmagoria wants to merge 8 commits intoRobLoach:nextfrom
execphantasmagoria:next
Open

[Fixes #381] Replaces GPU Skinning for Animation Blending#380
execphantasmagoria wants to merge 8 commits intoRobLoach:nextfrom
execphantasmagoria:next

Conversation

@execphantasmagoria
Copy link

@execphantasmagoria execphantasmagoria commented Mar 5, 2026

This series of commits do three things:

  • Updates the Matrix Multiply() and Matrix operator*() to polymorphically use the new MatrixMultiplyValue() when passed in a float argument.
  • Unload() now unloads one animation by default, unless provided an argument count.
  • UpdateBones() is replaced with Blend() to reflect new animation mechanism.

@execphantasmagoria execphantasmagoria changed the title Updated Multiply() and operator* to enable MatrixMultiplyValue() Updated Multiply() and operator*() to enable MatrixMultiplyValue() Mar 5, 2026
@execphantasmagoria execphantasmagoria marked this pull request as draft March 5, 2026 05:32
@execphantasmagoria execphantasmagoria marked this pull request as ready for review March 5, 2026 05:47
@execphantasmagoria execphantasmagoria marked this pull request as draft March 5, 2026 05:50
@execphantasmagoria execphantasmagoria marked this pull request as ready for review March 5, 2026 05:52
@execphantasmagoria execphantasmagoria changed the title Updated Multiply() and operator*() to enable MatrixMultiplyValue() Updated Multiply() and operator*() to enable MatrixMultiplyValue(), Updated potential memory leakage in Unload() Mar 5, 2026
@execphantasmagoria execphantasmagoria marked this pull request as draft March 5, 2026 10:41
@execphantasmagoria execphantasmagoria changed the title Updated Multiply() and operator*() to enable MatrixMultiplyValue(), Updated potential memory leakage in Unload() Updated Multiply() and operator*() to enable MatrixMultiplyValue(). Fixed Unload() to always unload 1 animation. Renamed UpdateModelAnimationEx() to BlendPose() Mar 5, 2026
@execphantasmagoria execphantasmagoria changed the title Updated Multiply() and operator*() to enable MatrixMultiplyValue(). Fixed Unload() to always unload 1 animation. Renamed UpdateModelAnimationEx() to BlendPose() [Fixes #381] Replaces GPU Skinning for Animation Blending Mar 5, 2026
@execphantasmagoria execphantasmagoria marked this pull request as ready for review March 5, 2026 14:33
@execphantasmagoria
Copy link
Author

It shouldn't have any more build errors.

*/
void Unload(int animCount) { ::UnloadModelAnimations(this, animCount); }
void Unload() {
::UnloadModelAnimations(this, 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an int* animCount that's returned when calling LoadModelAnimations(). Would there be a way for us to leverage that so that we don't have to worry about unloading 1 when there could be 10?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to use the populated int* animCount, we would have to make the Load() function a non-static method, such that it can store the object's animCount in an attribute and use in while unloading.

however, making it so requires a ModelAnimation object to call load, that may defeat the design philosphy of raylib. I will try to think of a workaround. The current workaround for this would be to use function overloading. Have the Unload() optionally accept an animCount. This assumes the programmer knows how many animations are loaded.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, that is a challenge. Surprised it's not kept in the ModelAnimation struct itself.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking to raysan, it is my understanding that UnloadModelAnimations() is meant to unload an array of animations, and a ModelAnimation object would only have 1. In that case, i believe there should a UnloadAnimations(int animCount) static method can be called with an array of animations, along with Unload() to unload the animation data of the object that calls it.

I have implemented the same.

@execphantasmagoria execphantasmagoria marked this pull request as draft March 6, 2026 03:45
@execphantasmagoria execphantasmagoria marked this pull request as ready for review March 6, 2026 13:39
@execphantasmagoria execphantasmagoria marked this pull request as draft March 6, 2026 13:41
@execphantasmagoria execphantasmagoria marked this pull request as ready for review March 6, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants