Made use of BufferMapper

Former-commit-id: 2b24f9d6cabf9fbf639b2c5e9319aaa304fe809a
This commit is contained in:
Lynix
2013-01-03 19:42:25 +01:00
parent 182c667603
commit 16cec38f9c
4 changed files with 68 additions and 117 deletions

View File

@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/SkeletalMesh.hpp>
#include <Nazara/Utility/BufferMapper.hpp>
#include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Utility/Skeleton.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
@@ -270,15 +271,10 @@ void NzSkeletalMesh::Skin(const NzSkeleton* skeleton) const
}
#endif
void* outputBuffer = m_impl->vertexBuffer->Map(nzBufferAccess_DiscardAndWrite);
if (!outputBuffer)
{
NazaraError("Failed to map vertex buffer");
return;
}
NzBufferMapper<NzVertexBuffer> mapper(m_impl->vertexBuffer, nzBufferAccess_DiscardAndWrite);
NzMeshVertex* inputVertex = reinterpret_cast<NzMeshVertex*>(m_impl->bindPoseBuffer);
NzMeshVertex* outputVertex = reinterpret_cast<NzMeshVertex*>(outputBuffer);
NzMeshVertex* outputVertex = reinterpret_cast<NzMeshVertex*>(mapper.GetPointer());
const NzJoint* joints = skeleton->GetJoints();
unsigned int vertexCount = m_impl->vertexBuffer->GetVertexCount();
@@ -314,8 +310,6 @@ void NzSkeletalMesh::Skin(const NzSkeleton* skeleton) const
outputVertex++;
}
m_impl->vertexBuffer->Unmap();
m_impl->aabb = skeleton->GetAABB();
}