Now properly serialize and deserialize rigged models

This commit is contained in:
Antoine Pilote
2023-09-17 20:16:04 -04:00
parent dd66c15794
commit c0f1178e7d
7 changed files with 143 additions and 37 deletions

View File

@@ -47,17 +47,18 @@ namespace Nuake
{
const std::string& boneName = bone.Name;
auto& animationTrack = animation->GetTrack(boneName);
auto animationTrack = animation->GetTrack(boneName);
Entity& boneEntity = m_Scene->GetEntity(boneName);
Entity& boneEnt = m_Scene->GetEntityByID(bone.EntityHandle);
///assert(boneEnt.GetHandle() == boneEntity.GetHandle());
if (boneEnt.IsValid())
{
auto& transformComponent = boneEnt.GetComponent<TransformComponent>();
bone.FinalTransform = transformComponent.GetGlobalTransform() * bone.Offset;
//if (!animationTrack.IsEmpty())
if (!animationTrack.IsEmpty())
{
// Get Update transform
animationTrack.Update(time);
@@ -76,7 +77,12 @@ namespace Nuake
transformComponent.Dirty = false;
}
}
else
{
// Find bone
}
for (auto& childBone : bone.Children)
{
UpdateBonePositionTraversal(childBone, animation, time);