Added read-only const access to buffers

Former-commit-id: 555f079e277869bc8f32732f24dfee704e17f324
This commit is contained in:
Lynix
2012-12-31 11:12:45 +01:00
parent e32e012c5a
commit 6fefa3fdd2
6 changed files with 66 additions and 6 deletions

View File

@@ -185,6 +185,25 @@ void* NzIndexBuffer::Map(nzBufferAccess access, unsigned int offset, unsigned in
return m_buffer->Map(access, m_startIndex+offset, (length) ? length : m_indexCount-offset);
}
const void* NzIndexBuffer::Map(nzBufferAccess access, unsigned int offset, unsigned int length) const
{
#if NAZARA_UTILITY_SAFE
if (!m_buffer)
{
NazaraError("Impossible to map sequential buffers");
return nullptr;
}
if (offset+length > m_indexCount)
{
NazaraError("Exceeding virtual buffer size");
return nullptr;
}
#endif
return m_buffer->Map(access, m_startIndex+offset, (length) ? length : m_indexCount-offset);
}
bool NzIndexBuffer::SetStorage(nzBufferStorage storage)
{
#if NAZARA_UTILITY_SAFE
@@ -198,7 +217,7 @@ bool NzIndexBuffer::SetStorage(nzBufferStorage storage)
return m_buffer->SetStorage(storage);
}
bool NzIndexBuffer::Unmap()
bool NzIndexBuffer::Unmap() const
{
#if NAZARA_UTILITY_SAFE
if (!m_buffer)