Utility/Buffer: Refactor Buffer classes

This commit is contained in:
Lynix
2016-12-09 08:56:46 +01:00
parent e66e0dfdce
commit d62720d610
29 changed files with 461 additions and 677 deletions

View File

@@ -25,42 +25,42 @@ namespace Nz
{
public:
VertexBuffer() = default;
VertexBuffer(const VertexDeclaration* vertexDeclaration, Buffer* buffer);
VertexBuffer(const VertexDeclaration* vertexDeclaration, Buffer* buffer, unsigned int startOffset, unsigned int endOffset);
VertexBuffer(const VertexDeclaration* vertexDeclaration, unsigned int length, UInt32 storage = DataStorage_Software, BufferUsage usage = BufferUsage_Static);
VertexBuffer(VertexDeclarationConstRef vertexDeclaration, BufferRef buffer);
VertexBuffer(VertexDeclarationConstRef vertexDeclaration, BufferRef buffer, UInt32 offset, UInt32 size);
VertexBuffer(VertexDeclarationConstRef vertexDeclaration, UInt32 length, DataStorage storage, BufferUsageFlags usage);
VertexBuffer(const VertexBuffer& vertexBuffer);
VertexBuffer(VertexBuffer&&) = delete;
~VertexBuffer();
bool Fill(const void* data, unsigned int startVertex, unsigned int length, bool forceDiscard = false);
bool FillRaw(const void* data, unsigned int offset, unsigned int size, bool forceDiscard = false);
bool Fill(const void* data, UInt32 startVertex, UInt32 length);
bool FillRaw(const void* data, UInt32 offset, UInt32 size);
Buffer* GetBuffer() const;
unsigned int GetEndOffset() const;
unsigned int GetStartOffset() const;
unsigned int GetStride() const;
unsigned int GetVertexCount() const;
const VertexDeclaration* GetVertexDeclaration() const;
inline const BufferRef& GetBuffer() const;
inline UInt32 GetEndOffset() const;
inline UInt32 GetStartOffset() const;
inline UInt32 GetStride() const;
inline UInt32 GetVertexCount() const;
inline const VertexDeclarationConstRef& GetVertexDeclaration() const;
bool IsHardware() const;
bool IsValid() const;
inline bool IsValid() const;
void* Map(BufferAccess access, unsigned int startVertex = 0, unsigned int length = 0);
void* Map(BufferAccess access, unsigned int startVertex = 0, unsigned int length = 0) const;
void* MapRaw(BufferAccess access, unsigned int offset = 0, unsigned int size = 0);
void* MapRaw(BufferAccess access, unsigned int offset = 0, unsigned int size = 0) const;
void* Map(BufferAccess access, UInt32 startVertex = 0, UInt32 length = 0);
void* Map(BufferAccess access, UInt32 startVertex = 0, UInt32 length = 0) const;
void* MapRaw(BufferAccess access, UInt32 offset = 0, UInt32 size = 0);
void* MapRaw(BufferAccess access, UInt32 offset = 0, UInt32 size = 0) const;
void Reset();
void Reset(const VertexDeclaration* vertexDeclaration, Buffer* buffer);
void Reset(const VertexDeclaration* vertexDeclaration, Buffer* buffer, unsigned int startOffset, unsigned int endOffset);
void Reset(const VertexDeclaration* vertexDeclaration, unsigned int length, UInt32 storage = DataStorage_Software, BufferUsage usage = BufferUsage_Static);
void Reset(VertexDeclarationConstRef vertexDeclaration, BufferRef buffer);
void Reset(VertexDeclarationConstRef vertexDeclaration, BufferRef buffer, UInt32 offset, UInt32 size);
void Reset(VertexDeclarationConstRef vertexDeclaration, UInt32 length, DataStorage storage, BufferUsageFlags usage);
void Reset(const VertexBuffer& vertexBuffer);
bool SetStorage(UInt32 storage);
void SetVertexDeclaration(const VertexDeclaration* vertexDeclaration);
void SetVertexDeclaration(VertexDeclarationConstRef vertexDeclaration);
void Unmap() const;
VertexBuffer& operator=(const VertexBuffer& vertexBuffer);
VertexBuffer& operator=(VertexBuffer&&) = delete;
template<typename... Args> static VertexBufferRef New(Args&&... args);
@@ -69,10 +69,10 @@ namespace Nz
private:
BufferRef m_buffer;
UInt32 m_endOffset;
UInt32 m_startOffset;
UInt32 m_vertexCount;
VertexDeclarationConstRef m_vertexDeclaration;
unsigned int m_endOffset;
unsigned int m_startOffset;
unsigned int m_vertexCount;
};
}