Fixed mesh animating modifying template skeleton
Former-commit-id: d70bd2ed7c8a38f879641a4b22be4876f6825edb
This commit is contained in:
@@ -112,6 +112,11 @@ nzSceneNodeType NzModel::GetSceneNodeType() const
|
||||
return nzSceneNodeType_Model;
|
||||
}
|
||||
|
||||
NzSkeleton* NzModel::GetSkeleton()
|
||||
{
|
||||
return &m_skeleton;
|
||||
}
|
||||
|
||||
const NzSkeleton* NzModel::GetSkeleton() const
|
||||
{
|
||||
return &m_skeleton;
|
||||
@@ -419,5 +424,5 @@ void NzModel::Update(float elapsedTime)
|
||||
}
|
||||
}
|
||||
|
||||
m_mesh->Animate(m_animation, m_currentFrame, m_nextFrame, m_interpolation);
|
||||
m_mesh->Animate(m_animation, m_currentFrame, m_nextFrame, m_interpolation, &m_skeleton);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ bool NzMesh::AddSubMesh(const NzString& identifier, NzSubMesh* subMesh)
|
||||
return true;
|
||||
}
|
||||
|
||||
void NzMesh::Animate(const NzAnimation* animation, unsigned int frameA, unsigned int frameB, float interpolation) const
|
||||
void NzMesh::Animate(const NzAnimation* animation, unsigned int frameA, unsigned int frameB, float interpolation, NzSkeleton* skeleton) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!m_impl)
|
||||
@@ -182,11 +182,19 @@ void NzMesh::Animate(const NzAnimation* animation, unsigned int frameA, unsigned
|
||||
break;
|
||||
|
||||
case nzAnimationType_Skeletal:
|
||||
animation->AnimateSkeleton(&m_impl->skeleton, frameA, frameB, interpolation);
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!skeleton)
|
||||
{
|
||||
NazaraError("Skeleton must be valid for skeletal animation");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
animation->AnimateSkeleton(skeleton, frameA, frameB, interpolation);
|
||||
for (NzSubMesh* subMesh : m_impl->subMeshes)
|
||||
{
|
||||
NzSkeletalMesh* skeletalMesh = static_cast<NzSkeletalMesh*>(subMesh);
|
||||
skeletalMesh->Skin(&m_impl->skeleton);
|
||||
skeletalMesh->Skin(skeleton);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user