Pyrogenesis  trunk
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
CVertexBufferManager Class Reference

#include <VertexBufferManager.h>

Classes

class  Handle
 

Public Types

enum  Group : u32 { Group::DEFAULT, Group::TERRAIN, Group::WATER, Group::COUNT }
 

Public Member Functions

Handle AllocateChunk (const size_t vertexSize, const size_t numberOfVertices, const Renderer::Backend::IBuffer::Type type, const bool dynamic, void *backingStore=nullptr, Group group=Group::DEFAULT)
 Try to allocate a vertex buffer of the given size and type. More...
 
void Release (CVertexBuffer::VBChunk *chunk)
 Returns the given chunk to its owning buffer. More...
 
size_t GetBytesReserved () const
 
size_t GetBytesAllocated () const
 
void Shutdown ()
 Explicit shutdown of the vertex buffer subsystem; releases all currently-allocated buffers. More...
 

Private Attributes

std::vector< std::unique_ptr< CVertexBuffer > > m_Buffers [static_cast< std::size_t >(Group::COUNT)]
 List of all known vertex buffers. More...
 

Member Enumeration Documentation

◆ Group

Enumerator
DEFAULT 
TERRAIN 
WATER 
COUNT 

Member Function Documentation

◆ AllocateChunk()

CVertexBufferManager::Handle CVertexBufferManager::AllocateChunk ( const size_t  vertexSize,
const size_t  numberOfVertices,
const Renderer::Backend::IBuffer::Type  type,
const bool  dynamic,
void *  backingStore = nullptr,
Group  group = Group::DEFAULT 
)

Try to allocate a vertex buffer of the given size and type.

AllocateChunk: try to allocate a buffer of given number of vertices (each of given size), with the given type, and using the given texture - return null if no free chunks available.

Parameters
vertexSizesize of each vertex in the buffer
numberOfVerticesnumber of vertices in the buffer
typebuffer type
dynamicwill be buffer updated frequently or not
backingStoreif not dynamic, this is nullptr; else for dynamic, this must be a copy of the vertex data that remains valid for the lifetime of the VBChunk
Returns
chunk, or empty handle if no free chunks available

◆ GetBytesAllocated()

size_t CVertexBufferManager::GetBytesAllocated ( ) const

◆ GetBytesReserved()

size_t CVertexBufferManager::GetBytesReserved ( ) const

◆ Release()

void CVertexBufferManager::Release ( CVertexBuffer::VBChunk chunk)

Returns the given chunk to its owning buffer.

◆ Shutdown()

void CVertexBufferManager::Shutdown ( )

Explicit shutdown of the vertex buffer subsystem; releases all currently-allocated buffers.

Member Data Documentation

◆ m_Buffers

std::vector<std::unique_ptr<CVertexBuffer> > CVertexBufferManager::m_Buffers[static_cast< std::size_t >(Group::COUNT)]
private

List of all known vertex buffers.


The documentation for this class was generated from the following files: