Animation WIP merge #321
|
@ -143,7 +143,7 @@ namespace SHADE
|
|||
{
|
||||
// Check if there is a channel for this node
|
||||
const std::string& BONE_NAME = rig->GetName(node);
|
||||
SHMatrix transformMatrix = SHMatrix::Identity;
|
||||
SHMatrix transformMatrix = node->TransformMatrix;
|
||||
if (channelMap.contains(BONE_NAME))
|
||||
{
|
||||
const auto CHANNEL = channelMap[BONE_NAME];
|
||||
|
@ -154,19 +154,15 @@ namespace SHADE
|
|||
getInterpolatedValue(CHANNEL->ScaleKeyFrames, closestFrameIndex, poseTime)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
transformMatrix = SHMatrix::Inverse(node->OffsetMatrix); // TODO: Use TransformMatrix for the bone
|
||||
}
|
||||
|
||||
// Apply parent's transformation
|
||||
transformMatrix = parentMatrix * transformMatrix;
|
||||
transformMatrix = transformMatrix * parentMatrix;
|
||||
|
||||
// Apply transformations to this node
|
||||
const int BONE_MTX_IDX = rig->GetNodeIndex(node);
|
||||
if (BONE_MTX_IDX >= 0)
|
||||
{
|
||||
boneMatrices[BONE_MTX_IDX] = rig->GetGlobalInverseMatrix() * transformMatrix * node->OffsetMatrix;
|
||||
boneMatrices[BONE_MTX_IDX] = node->OffsetMatrix * transformMatrix * rig->GetGlobalInverseMatrix();
|
||||
}
|
||||
|
||||
// Apply pose to children
|
||||
|
|
|
@ -86,7 +86,8 @@ namespace SHADE
|
|||
|
||||
// Fill the node with data
|
||||
const auto& NODE_DATA = asset.nodeDataCollection.at(sourceNode->idRef);
|
||||
newNode->OffsetMatrix = SHMatrix::Inverse(NODE_DATA.transform);
|
||||
newNode->OffsetMatrix = SHMatrix::Transpose(NODE_DATA.offset);
|
||||
newNode->TransformMatrix = SHMatrix::Transpose(NODE_DATA.transform);
|
||||
|
||||
// Populate maps
|
||||
if (!NODE_DATA.name.empty())
|
||||
|
|
|
@ -43,6 +43,10 @@ namespace SHADE
|
|||
/// </summary>
|
||||
SHMatrix OffsetMatrix;
|
||||
/// <summary>
|
||||
/// Matrix that performs a transformation from bone (node) space to local space.
|
||||
/// </summary>
|
||||
SHMatrix TransformMatrix;
|
||||
/// <summary>
|
||||
/// Child nodes of this node.
|
||||
/// </summary>
|
||||
std::vector<Handle<SHRigNode>> Children;
|
||||
|
|
Loading…
Reference in New Issue