Optimize animations retargeting between skeletons

Cuts down `RetargetSkeletonPose` time down by over 80%.

#3827
This commit is contained in:
Wojtek Figat
2026-02-09 15:03:42 +01:00
parent 9c32f978fb
commit 3d66316716
4 changed files with 116 additions and 66 deletions

View File

@@ -73,6 +73,10 @@ struct TIsPODType<SkeletonBone>
/// </remarks>
class FLAXENGINE_API SkeletonData
{
private:
mutable volatile int64 _dirty = 1;
mutable Array<Matrix> _cachedPose;
public:
/// <summary>
/// The nodes in this hierarchy. The root node is always at the index 0.
@@ -114,6 +118,11 @@ public:
int32 FindNode(const StringView& name) const;
int32 FindBone(int32 nodeIndex) const;
// Gets the skeleton nodes transforms in mesh space (pose). Calculated from the local node transforms and hierarchy. Cached internally and updated when data is dirty.
const Array<Matrix>& GetNodesPose() const;
// Marks data as dirty (modified) to update internal state and recalculate cached data if needed (eg. skeleton pose).
void Dirty();
uint64 GetMemoryUsage() const;
/// <summary>