Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::VertexBuffer Class Referenceabstract
Inheritance diagram for Burger::VertexBuffer:
Collaboration diagram for Burger::VertexBuffer:

Classes

struct  VertexAoS_t
 

Public Types

enum  eUsage {
  USAGE_CHUNKMASK = 0xFF0 , USAGE_CHUNKMASKSHIFT = 4 , USAGE_TYPEMASK =0xF000 , USAGE_TYPEMASKSHIFT = 12 ,
  USAGE_FLOAT1 = 0<<USAGE_CHUNKMASKSHIFT , USAGE_FLOAT2 = 1<<USAGE_CHUNKMASKSHIFT , USAGE_FLOAT3 = 2<<USAGE_CHUNKMASKSHIFT , USAGE_FLOAT4 = 3<<USAGE_CHUNKMASKSHIFT ,
  USAGE_COLOR4 = 4<<USAGE_CHUNKMASKSHIFT , USAGE_POSITION =0<<USAGE_TYPEMASKSHIFT , USAGE_BLENDWEIGHT =1<<USAGE_TYPEMASKSHIFT , USAGE_BLENDINDICES =2<<USAGE_TYPEMASKSHIFT ,
  USAGE_NORMAL =3<<USAGE_TYPEMASKSHIFT , USAGE_PSIZE =4<<USAGE_TYPEMASKSHIFT , USAGE_TEXCOORD =5<<USAGE_TYPEMASKSHIFT , USAGE_TANGENT =6<<USAGE_TYPEMASKSHIFT ,
  USAGE_BINORMAL =7<<USAGE_TYPEMASKSHIFT , USAGE_TESSFACTOR =8<<USAGE_TYPEMASKSHIFT , USAGE_POSITIONT =9<<USAGE_TYPEMASKSHIFT , USAGE_COLOR =10<<USAGE_TYPEMASKSHIFT ,
  USAGE_FOG =11<<USAGE_TYPEMASKSHIFT , USAGE_DEPTH =12<<USAGE_TYPEMASKSHIFT , USAGE_SAMPLE =13<<USAGE_TYPEMASKSHIFT , FLAGAOS_DONTCOPY_VERTICES = 1<<0 ,
  FLAGAOS_DONTCOPY_ELEMENTS = 1<<1 , FLAGAOS_DONTCOPY_MEMBERS = 1<<2 , FLAGAOS_VERTICES_DYNAMIC = 1<<3 , FLAGAOS_ELEMENTS_32BIT = 1<<4 ,
  FLAG_VERTEXDIRTY = 1<<30 , USAGE_END =0x7FFFFFFFU
}
 

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 VertexBuffer ()
 Default constructor.
 
virtual ~VertexBuffer ()
 Default destructor.
 
uint_t CheckLoad (Display *pDisplay) override=0
 Upload vertex data from VRAM.
 
void Release (Display *pDisplay) override=0
 Release vertex data from VRAM.
 
uint_t LoadData (Display *pDisplay, const VertexAoS_t *pDescription)
 Load vertex data to VRAM.
 
void PurgeData (void)
 Release allocated memory buffers.
 
D3DVertexBuffer * GetD3DVertexBuffer (void) const
 
D3DVertexDeclaration * GetD3DVertexDescription (void) const
 
D3DIndexBuffer * GetD3DIndexBuffer (void) const
 
IDirect3DVertexBuffer9 * GetDX9VertexBuffer (void) const
 
IDirect3DVertexDeclaration9 * GetDX9VertexDescription (void) const
 
IDirect3DIndexBuffer9 * GetDX9IndexBuffer (void) const
 
uint_t GetVertexArrayObject (void) const
 
uint_t GetElementID (void) const
 
uint_t GetBufferID (void) const
 
uint_t GetStride (void) const
 
uint_t GetArrayEntryCount (void) const
 
uint_t GetElementEntryCount (void) const
 
- Public Member Functions inherited from Burger::DisplayObject
DisplayObjectGetNext (void) const
 Get the next display object in the global linked list.
 
DisplayObjectGetPrevious (void) const
 Get the previous display object in the global linked list.
 
- Public Member Functions inherited from Burger::ReferenceCounter
 ReferenceCounter () noexcept
 Sets the reference count to zero.
 
virtual ~ReferenceCounter ()
 Destructor.
 
void AddRef (void) noexcept
 Increase the reference count by 1.
 
void Release (void) noexcept
 Decrease the reference count by 1.
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 
static const uint_t g_ChunkElementSizes [5] = {4,4,4,4,1}
 Size of each element for the USAGE_* chunk sizes.
 
static const uint_t g_ChunkElementCounts [5] = {1,2,3,4,4}
 Number of elements for the USAGE_* chunks.
 
- Static Public Attributes inherited from Burger::DisplayObject
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::ReferenceCounter
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Protected Attributes

const void * m_pVertexArray
 Pointer to the vertex data to upload, if NULL don't upload data.
 
uintptr_t m_uVertexArraySize
 Size in bytes of the entire vertex buffer, if 0, don't generate vertex data.
 
const void * m_pElements
 Pointer to the element index data to upload, NULL don't upload data.
 
uintptr_t m_uElementSize
 Size in bytes of the entire element buffer, if 0, don't generate an element index array.
 
const uint_tm_pMembers
 Pointer to array of array description enumerations.
 
D3DVertexBuffer * m_pD3DVertexBuffer
 (XBox 360 Only) DirectX vertex buffer
 
D3DVertexDeclaration * m_pD3DVertexDeclaration
 (XBox 360 Only) DirectX vertex array description
 
D3DIndexBuffer * m_pD3DIndexBuffer
 (XBox 360 Only) DirectX index buffer
 
union { 
 
   struct { 
 
      IDirect3DVertexBuffer9 *   m_pVertexBuffer 
 DirectX 9 vertex buffer. More...
 
      IDirect3DVertexDeclaration9 *   m_pDescription 
 DirectX 9 vertex array description. More...
 
      IDirect3DIndexBuffer9 *   m_pIndexBuffer 
 DirectX 9 index buffer. More...
 
   }   m_DX9 
 DirectX 9 specific data. More...
 
   struct { 
 
      uint_t   m_uVertexArrayObjectID 
 (OpenGL only) Main Vertex Object Array More...
 
      uint_t   m_uElementID 
 (OpenGL only) ID to the index array More...
 
      uint_t   m_uBufferID 
 (OpenGL only) ID for the buffer More...
 
   }   m_GL 
 OpenGL specific data. More...
 
m_Platform 
 Union of vertex buffer data for the platform.
 
uint_t m_uStride
 Size in bytes of each entry in the vertex array.
 
uint_t m_uArrayEntryCount
 Number of entries in the vertex array.
 
uint_t m_uElementEntryCount
 Number of entries in the element array.
 
uint_t m_uMemberCount
 Number of entries in the member array.
 
uint_t m_uFlags
 Flags describing how to treat the data.
 
- Protected Attributes inherited from Burger::DisplayObject
DisplayObjectm_pNextDisplayObject
 Pointer to the next DisplayObject.
 
DisplayObjectm_pPrevDisplayObject
 Pointer to the previous DisplayObject.
 

Private Member Functions

 VertexBuffer (const VertexBuffer &)=delete
 
VertexBufferoperator= (const VertexBuffer &)=delete
 
 VertexBuffer (VertexBuffer &&)=delete
 
VertexBufferoperator= (VertexBuffer &&)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Burger::DisplayObject
static DisplayObjectGetFirstObject (void)
 Get the first display object in the global linked list.
 
static void ReleaseAll (Display *pDisplay)
 Release all display objects.
 
- Protected Member Functions inherited from Burger::DisplayObject
 DisplayObject (void)
 Add this display object to the global linked list.
 
virtual ~DisplayObject ()
 Remove this display object from the global linked list.
 
- Static Protected Attributes inherited from Burger::DisplayObject
static DisplayObjectg_pHead = NULL
 Global pointer to the linked list of display objects.
 

Member Enumeration Documentation

◆ eUsage

Enumerator
USAGE_CHUNKMASK 

Mask for the chunk type.

USAGE_CHUNKMASKSHIFT 

Shift for the chunk type.

USAGE_TYPEMASK 

Mask for the data type.

USAGE_TYPEMASKSHIFT 

Shift for the data type.

USAGE_FLOAT1 

Data chunks is a single float.

USAGE_FLOAT2 

Data chunks is 2 floats.

USAGE_FLOAT3 

Data chunks is 3 floats.

USAGE_FLOAT4 

Data chunks is 4 floats.

USAGE_COLOR4 

Data chunks are color bytes (0-255 is 0.0f to 1.0f)

USAGE_POSITION 

Data type is a position.

USAGE_BLENDWEIGHT 

Data type is a blend weight.

USAGE_BLENDINDICES 

Data type is a blend index.

USAGE_NORMAL 

Data type is a vertex normal.

USAGE_PSIZE 

Data type is a point size.

USAGE_TEXCOORD 

Data type is a texture coordinate.

USAGE_TANGENT 

Data type is a vertex tangent.

USAGE_BINORMAL 

Data type is a vertex bi-normal.

USAGE_TESSFACTOR 

Data type is a tessellation factor.

USAGE_POSITIONT 

Data type is a transformed position.

USAGE_COLOR 

Data type is a vertex color.

USAGE_FOG 

Data type is a fog constant.

USAGE_DEPTH 

Data type is a depth value.

USAGE_SAMPLE 

Data type is a texture value.

FLAGAOS_DONTCOPY_VERTICES 

For VertexAoS_t, the m_pVertexArray entry is persistent, don't copy it.

FLAGAOS_DONTCOPY_ELEMENTS 

For VertexAoS_t, the m_pElements entry is persistent, don't copy it.

FLAGAOS_DONTCOPY_MEMBERS 

For VertexAoS_t, the m_pMembers entry is persistent, don't copy it.

FLAGAOS_VERTICES_DYNAMIC 

For VertexAoS_t, hint that the vertices will be modifed in future calls.

FLAGAOS_ELEMENTS_32BIT 

For VertexAoS_t, elements are 16 bit, unless this flag is set, and then they are 32 bits per entry.

FLAG_VERTEXDIRTY 

Internal flag, set when vertex data was changed and an upload is queued.

USAGE_END 

End of the data.

Constructor & Destructor Documentation

◆ VertexBuffer() [1/3]

Burger::VertexBuffer::VertexBuffer ( const VertexBuffer & )
privatedelete

◆ VertexBuffer() [2/3]

Burger::VertexBuffer::VertexBuffer ( VertexBuffer && )
privatedelete

◆ VertexBuffer() [3/3]

Burger::VertexBuffer::VertexBuffer ( )

Default constructor.


Initialize to an empty vertex buffer

◆ ~VertexBuffer()

Burger::VertexBuffer::~VertexBuffer ( )
virtual

Default destructor.


Release all data

See also
Shutdown(void)

Member Function Documentation

◆ CheckLoad()

uint_t Burger::VertexBuffer::CheckLoad ( Display * pDisplay)
overridepure virtual

Upload vertex data from VRAM.


If any data needed to be uploaded to VRAM, upload it.

Parameters
pDisplayPointer to the parent display device
Returns
Zero on success, non-zero on failure
See also
Release(Display *)

Implements Burger::DisplayObject.

Implemented in Burger::VertexBufferDirectX9, and Burger::VertexBufferOpenGL.

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::VertexBuffer::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::DisplayObject.

Reimplemented in Burger::VertexBufferDirectX9, and Burger::VertexBufferOpenGL.

◆ GetArrayEntryCount()

uint_t Burger::VertexBuffer::GetArrayEntryCount ( void ) const
inline

◆ GetBufferID()

uint_t Burger::VertexBuffer::GetBufferID ( void ) const
inline

◆ GetD3DIndexBuffer()

D3DIndexBuffer * Burger::VertexBuffer::GetD3DIndexBuffer ( void ) const
inline

◆ GetD3DVertexBuffer()

D3DVertexBuffer * Burger::VertexBuffer::GetD3DVertexBuffer ( void ) const
inline

◆ GetD3DVertexDescription()

D3DVertexDeclaration * Burger::VertexBuffer::GetD3DVertexDescription ( void ) const
inline

◆ GetDX9IndexBuffer()

IDirect3DIndexBuffer9 * Burger::VertexBuffer::GetDX9IndexBuffer ( void ) const
inline

◆ GetDX9VertexBuffer()

IDirect3DVertexBuffer9 * Burger::VertexBuffer::GetDX9VertexBuffer ( void ) const
inline

◆ GetDX9VertexDescription()

IDirect3DVertexDeclaration9 * Burger::VertexBuffer::GetDX9VertexDescription ( void ) const
inline

◆ GetElementEntryCount()

uint_t Burger::VertexBuffer::GetElementEntryCount ( void ) const
inline

◆ GetElementID()

uint_t Burger::VertexBuffer::GetElementID ( void ) const
inline

◆ GetStride()

uint_t Burger::VertexBuffer::GetStride ( void ) const
inline

◆ GetVertexArrayObject()

uint_t Burger::VertexBuffer::GetVertexArrayObject ( void ) const
inline

◆ LoadData()

uint_t BURGER_API Burger::VertexBuffer::LoadData ( Display * pDisplay,
const VertexAoS_t * pDescription )

Load vertex data to VRAM.


Given a pointer to the display to render to and a structure describing the vertex data, upload the data to VRAM and retain information to allow rendering with graphics primitives

Parameters
pDisplayPointer to the current display
pDescriptionPointer to an initialized structure that describes the data to upload to VRAM.
See also
Release(Display *)

◆ operator=() [1/2]

VertexBuffer & Burger::VertexBuffer::operator= ( const VertexBuffer & )
privatedelete

◆ operator=() [2/2]

VertexBuffer & Burger::VertexBuffer::operator= ( VertexBuffer && )
privatedelete

◆ PurgeData()

void BURGER_API Burger::VertexBuffer::PurgeData ( void )

Release allocated memory buffers.


Clear out an allocated memory arrays from system memory. This function does not clear out platform specific data.

See also
LoadData(const VertexAoS_t *)

◆ Release()

void Burger::VertexBuffer::Release ( Display * pDisplay)
overridepure virtual

Release vertex data from VRAM.


If any data was uploaded to VRAM, release it.

Parameters
pDisplayPointer to the parent display device
See also
CheckLoad(Display *)

Implements Burger::DisplayObject.

Implemented in Burger::VertexBufferDirectX9, and Burger::VertexBufferOpenGL.

Member Data Documentation

◆ g_ChunkElementCounts

const uint_t Burger::VertexBuffer::g_ChunkElementCounts = {1,2,3,4,4}
static

Number of elements for the USAGE_* chunks.

◆ g_ChunkElementSizes

const uint_t Burger::VertexBuffer::g_ChunkElementSizes = {4,4,4,4,1}
static

Size of each element for the USAGE_* chunk sizes.

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::VertexBuffer::g_StaticRTTI
static

◆ [struct]

struct { ... } Burger::VertexBuffer::m_DX9

DirectX 9 specific data.

◆ [struct]

struct { ... } Burger::VertexBuffer::m_GL

OpenGL specific data.

◆ m_pD3DIndexBuffer

D3DIndexBuffer* Burger::VertexBuffer::m_pD3DIndexBuffer
protected

(XBox 360 Only) DirectX index buffer

◆ m_pD3DVertexBuffer

D3DVertexBuffer* Burger::VertexBuffer::m_pD3DVertexBuffer
protected

(XBox 360 Only) DirectX vertex buffer

◆ m_pD3DVertexDeclaration

D3DVertexDeclaration* Burger::VertexBuffer::m_pD3DVertexDeclaration
protected

(XBox 360 Only) DirectX vertex array description

◆ m_pDescription

IDirect3DVertexDeclaration9* Burger::VertexBuffer::m_pDescription

DirectX 9 vertex array description.

◆ m_pElements

const void* Burger::VertexBuffer::m_pElements
protected

Pointer to the element index data to upload, NULL don't upload data.

◆ m_pIndexBuffer

IDirect3DIndexBuffer9* Burger::VertexBuffer::m_pIndexBuffer

DirectX 9 index buffer.

◆ [union]

union { ... } Burger::VertexBuffer::m_Platform

Union of vertex buffer data for the platform.

◆ m_pMembers

const uint_t* Burger::VertexBuffer::m_pMembers
protected

Pointer to array of array description enumerations.

◆ m_pVertexArray

const void* Burger::VertexBuffer::m_pVertexArray
protected

Pointer to the vertex data to upload, if NULL don't upload data.

◆ m_pVertexBuffer

IDirect3DVertexBuffer9* Burger::VertexBuffer::m_pVertexBuffer

DirectX 9 vertex buffer.

◆ m_uArrayEntryCount

uint_t Burger::VertexBuffer::m_uArrayEntryCount
protected

Number of entries in the vertex array.

◆ m_uBufferID

uint_t Burger::VertexBuffer::m_uBufferID

(OpenGL only) ID for the buffer

◆ m_uElementEntryCount

uint_t Burger::VertexBuffer::m_uElementEntryCount
protected

Number of entries in the element array.

◆ m_uElementID

uint_t Burger::VertexBuffer::m_uElementID

(OpenGL only) ID to the index array

◆ m_uElementSize

uintptr_t Burger::VertexBuffer::m_uElementSize
protected

Size in bytes of the entire element buffer, if 0, don't generate an element index array.

◆ m_uFlags

uint_t Burger::VertexBuffer::m_uFlags
protected

Flags describing how to treat the data.

◆ m_uMemberCount

uint_t Burger::VertexBuffer::m_uMemberCount
protected

Number of entries in the member array.

◆ m_uStride

uint_t Burger::VertexBuffer::m_uStride
protected

Size in bytes of each entry in the vertex array.

◆ m_uVertexArrayObjectID

uint_t Burger::VertexBuffer::m_uVertexArrayObjectID

(OpenGL only) Main Vertex Object Array

◆ m_uVertexArraySize

uintptr_t Burger::VertexBuffer::m_uVertexArraySize
protected

Size in bytes of the entire vertex buffer, if 0, don't generate vertex data.