Removed buggy animation debug draw

This commit is contained in:
Kah Wei 2023-01-29 14:45:46 +08:00
parent 80a7fe701b
commit 1472823dc0
2 changed files with 4 additions and 8 deletions

View File

@ -114,7 +114,7 @@ namespace SHADE
return; return;
// Update time on the playback // Update time on the playback
currPlaybackTime += dt * 0.01f; currPlaybackTime += dt;
if (currPlaybackTime > currClip->GetTotalTime()) if (currPlaybackTime > currClip->GetTotalTime())
{ {
currPlaybackTime = currPlaybackTime - currClip->GetTotalTime(); currPlaybackTime = currPlaybackTime - currClip->GetTotalTime();
@ -140,7 +140,7 @@ namespace SHADE
updatePoseWithClip(CLOSEST_FRAME_IDX, poseTime, rig->GetRootNode(), SHMatrix::Identity); updatePoseWithClip(CLOSEST_FRAME_IDX, poseTime, rig->GetRootNode(), SHMatrix::Identity);
} }
void SHAnimatorComponent::updatePoseWithClip(int closestFrameIndex, float poseTime, Handle<SHRigNode> node, const SHMatrix& parentMatrix, std::optional<SHVec3> worldPos) void SHAnimatorComponent::updatePoseWithClip(int closestFrameIndex, float poseTime, Handle<SHRigNode> node, const SHMatrix& parentMatrix)
{ {
// Check if there is a channel for this node // Check if there is a channel for this node
const std::string& BONE_NAME = rig->GetName(node); const std::string& BONE_NAME = rig->GetName(node);
@ -165,16 +165,12 @@ namespace SHADE
if (BONE_MTX_IDX >= 0) if (BONE_MTX_IDX >= 0)
{ {
boneMatrices[BONE_MTX_IDX] = node->OffsetMatrix * transformMatrix; boneMatrices[BONE_MTX_IDX] = node->OffsetMatrix * transformMatrix;
position = SHVec3(boneMatrices[BONE_MTX_IDX]._41, boneMatrices[BONE_MTX_IDX]._42, boneMatrices[BONE_MTX_IDX]._43);
SHDebugDraw::Cube(position.value(), SHQuaternion{}, SHVec3(0.01f, 0.01f, 0.01f), SHColour::ORANGE);
if (worldPos.has_value())
SHDebugDraw::Line(position.value(), worldPos.value(), SHColour::ORANGE);
} }
// Apply pose to children // Apply pose to children
for (auto& child : node->Children) for (auto& child : node->Children)
{ {
updatePoseWithClip(closestFrameIndex, poseTime, child, transformMatrix, position); updatePoseWithClip(closestFrameIndex, poseTime, child, transformMatrix);
} }
} }
} }

View File

@ -141,7 +141,7 @@ namespace SHADE
/* Helper Functions */ /* Helper Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
void updatePoseWithClip(float poseTime); void updatePoseWithClip(float poseTime);
void updatePoseWithClip(int closestFrameIndex, float poseTime, Handle<SHRigNode> node, const SHMatrix& parentMatrix, std::optional<SHVec3> worldPos = {}); void updatePoseWithClip(int closestFrameIndex, float poseTime, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
template<typename T> template<typename T>
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, int closestFrameIndex, float poseTime); T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, int closestFrameIndex, float poseTime);