Add SetCurrentPose to Animated Model
This commit is contained in:
@@ -132,6 +132,21 @@ void AnimatedModel::GetCurrentPose(Array<Matrix>& nodesTransformation, bool worl
|
||||
}
|
||||
}
|
||||
|
||||
void AnimatedModel::SetCurrentPose(const Array<Matrix>& nodesTransformation, bool worldSpace)
|
||||
{
|
||||
if (GraphInstance.NodesPose.Count() == 0)
|
||||
return;
|
||||
CHECK(nodesTransformation.Count() == GraphInstance.NodesPose.Count());
|
||||
GraphInstance.NodesPose = nodesTransformation;
|
||||
if (worldSpace)
|
||||
{
|
||||
Matrix invWorld;
|
||||
Matrix::Invert(_world, invWorld);
|
||||
for (auto& m : GraphInstance.NodesPose)
|
||||
m = invWorld * m;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimatedModel::GetNodeTransformation(int32 nodeIndex, Matrix& nodeTransformation, bool worldSpace) const
|
||||
{
|
||||
if (nodeIndex >= 0 && nodeIndex < GraphInstance.NodesPose.Count())
|
||||
|
||||
@@ -187,12 +187,19 @@ public:
|
||||
API_FUNCTION() void PreInitSkinningData();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the per-node final transformations.
|
||||
/// Gets the per-node final transformations (skeleton pose).
|
||||
/// </summary>
|
||||
/// <param name="nodesTransformation">The output per-node final transformation matrices.</param>
|
||||
/// <param name="worldSpace">True if convert matrices into world-space, otherwise returned values will be in local-space of the actor.</param>
|
||||
API_FUNCTION() void GetCurrentPose(API_PARAM(Out) Array<Matrix>& nodesTransformation, bool worldSpace = false) const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the per-node final transformations (skeleton pose).
|
||||
/// </summary>
|
||||
/// <param name="nodesTransformation">The per-node final transformation matrices.</param>
|
||||
/// <param name="worldSpace">True if convert matrices from world-space, otherwise values are in local-space of the actor.</param>
|
||||
API_FUNCTION() void SetCurrentPose(const Array<Matrix>& nodesTransformation, bool worldSpace = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the node final transformation.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user