Added indices optimisation algorithm

Former-commit-id: 89086e814ca11a048949fe0fc6e20648824bbb36
This commit is contained in:
Lynix
2013-06-05 19:39:48 +02:00
parent 910a79fc84
commit ccb6f5b729
4 changed files with 539 additions and 0 deletions

View File

@@ -4,7 +4,10 @@
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Algorithm.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/IndexIterator.hpp>
#include <Nazara/Utility/IndexMapper.hpp>
#include <stdexcept>
#include <Nazara/Utility/Debug.hpp>
@@ -64,6 +67,13 @@ m_startIndex(indexBuffer.m_startIndex)
NzIndexBuffer::~NzIndexBuffer() = default;
unsigned int NzIndexBuffer::ComputeCacheMissCount() const
{
NzIndexMapper mapper(this);
return NzComputeCacheMissCount(mapper.begin(), m_indexCount);
}
bool NzIndexBuffer::Fill(const void* data, unsigned int offset, unsigned int length, bool forceDiscard)
{
#if NAZARA_UTILITY_SAFE
@@ -193,6 +203,13 @@ void* NzIndexBuffer::Map(nzBufferAccess access, unsigned int offset, unsigned in
return m_buffer->Map(access, m_startIndex+offset, (length) ? length : m_indexCount-offset);
}
void NzIndexBuffer::Optimize()
{
NzIndexMapper mapper(this);
NzOptimizeIndices(mapper.begin(), m_indexCount);
}
bool NzIndexBuffer::SetStorage(nzBufferStorage storage)
{
#if NAZARA_UTILITY_SAFE