Files
NazaraEngine/include/Nazara/Utility/IndexBuffer.hpp
Lynix b06acfcffd Index buffer no longer permit 8 bits index size
Modern graphics cards don't like 8 bits index size, so I introduced
"Large indices" option, it means 32 bits indices when used otherwise the
index size is 16 bits


Former-commit-id: 213902de6704ceef16c6ea311ba0c6c5d2f6e665
2012-12-02 17:01:02 +01:00

49 lines
1.3 KiB
C++

// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_INDEXBUFFER_HPP
#define NAZARA_INDEXBUFFER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Utility/Buffer.hpp>
class NAZARA_API NzIndexBuffer : public NzResource
{
public:
NzIndexBuffer(NzBuffer* buffer, unsigned int startIndex, unsigned int indexCount);
NzIndexBuffer(unsigned int length, bool largeIndices = false, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
NzIndexBuffer(const NzIndexBuffer& indexBuffer);
~NzIndexBuffer();
bool Fill(const void* data, unsigned int offset, unsigned int length);
NzBuffer* GetBuffer() const;
unsigned int GetIndexCount() const;
void* GetPointer();
const void* GetPointer() const;
unsigned int GetStartIndex() const;
bool HasLargeIndices() const;
bool IsHardware() const;
bool IsSequential() const;
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int length = 0);
bool SetStorage(nzBufferStorage storage);
bool Unmap();
private:
NzBuffer* m_buffer;
bool m_ownsBuffer;
unsigned int m_indexCount;
unsigned int m_startIndex;
};
#endif // NAZARA_INDEXBUFFER_HPP