From 1472823dc0e25cc889d0c648e19f064071004278 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sun, 29 Jan 2023 14:45:46 +0800 Subject: [PATCH] Removed buggy animation debug draw --- SHADE_Engine/src/Animation/SHAnimatorComponent.cpp | 10 +++------- SHADE_Engine/src/Animation/SHAnimatorComponent.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp index 7a397a4c..932a857a 100644 --- a/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp +++ b/SHADE_Engine/src/Animation/SHAnimatorComponent.cpp @@ -114,7 +114,7 @@ namespace SHADE return; // Update time on the playback - currPlaybackTime += dt * 0.01f; + currPlaybackTime += dt; if (currPlaybackTime > currClip->GetTotalTime()) { currPlaybackTime = currPlaybackTime - currClip->GetTotalTime(); @@ -140,7 +140,7 @@ namespace SHADE updatePoseWithClip(CLOSEST_FRAME_IDX, poseTime, rig->GetRootNode(), SHMatrix::Identity); } - void SHAnimatorComponent::updatePoseWithClip(int closestFrameIndex, float poseTime, Handle node, const SHMatrix& parentMatrix, std::optional worldPos) + void SHAnimatorComponent::updatePoseWithClip(int closestFrameIndex, float poseTime, Handle node, const SHMatrix& parentMatrix) { // Check if there is a channel for this node const std::string& BONE_NAME = rig->GetName(node); @@ -165,16 +165,12 @@ namespace SHADE if (BONE_MTX_IDX >= 0) { 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 for (auto& child : node->Children) { - updatePoseWithClip(closestFrameIndex, poseTime, child, transformMatrix, position); + updatePoseWithClip(closestFrameIndex, poseTime, child, transformMatrix); } } } diff --git a/SHADE_Engine/src/Animation/SHAnimatorComponent.h b/SHADE_Engine/src/Animation/SHAnimatorComponent.h index 95123e8d..b47106f8 100644 --- a/SHADE_Engine/src/Animation/SHAnimatorComponent.h +++ b/SHADE_Engine/src/Animation/SHAnimatorComponent.h @@ -141,7 +141,7 @@ namespace SHADE /* Helper Functions */ /*---------------------------------------------------------------------------------*/ void updatePoseWithClip(float poseTime); - void updatePoseWithClip(int closestFrameIndex, float poseTime, Handle node, const SHMatrix& parentMatrix, std::optional worldPos = {}); + void updatePoseWithClip(int closestFrameIndex, float poseTime, Handle node, const SHMatrix& parentMatrix); template T getInterpolatedValue(const std::vector>& keyframes, int closestFrameIndex, float poseTime);