Meshes no longer retains an animation pointer

Former-commit-id: da4d93b815c46284a8977d7fb142201dc23fff61
This commit is contained in:
Lynix
2012-11-27 23:33:11 +01:00
parent c019d02b91
commit 2e26d52248
4 changed files with 165 additions and 21 deletions

View File

@@ -4,6 +4,7 @@
#include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Animation.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/KeyframeMesh.hpp>
@@ -23,12 +24,6 @@ NzMeshParams::NzMeshParams()
bool NzMeshParams::IsValid() const
{
if (!animation.IsValid())
{
NazaraError("Invalid animation parameters");
return false;
}
if (!NzBuffer::IsSupported(storage))
{
NazaraError("Storage not supported");
@@ -46,6 +41,7 @@ struct NzMeshImpl
nzAnimationType animationType;
NzAxisAlignedBox aabb;
NzSkeleton skeleton; // Uniquement pour les animations squelettiques
NzString animationPath;
unsigned int jointCount; // Uniquement pour les animations squelettiques
};
@@ -275,6 +271,19 @@ const NzAxisAlignedBox& NzMesh::GetAABB() const
return m_impl->aabb;
}
NzString NzMesh::GetAnimation() const
{
#if NAZARA_UTILITY_SAFE
if (!m_impl)
{
NazaraError("Mesh not created");
return nzAnimationType_Static;
}
#endif
return m_impl->animationPath;
}
nzAnimationType NzMesh::GetAnimationType() const
{
#if NAZARA_UTILITY_SAFE
@@ -645,6 +654,19 @@ void NzMesh::RemoveSubMesh(unsigned int index)
m_impl->aabb.SetNull(); // On invalide l'AABB
}
void NzMesh::SetAnimation(const NzString& animationPath)
{
#if NAZARA_UTILITY_SAFE
if (!m_impl)
{
NazaraError("Mesh not created");
return;
}
#endif
m_impl->animationPath = animationPath;
}
void NzMesh::SetMaterial(unsigned int matIndex, const NzString& materialPath)
{
#if NAZARA_UTILITY_SAFE