Castor3D  ..
Public Member Functions | Protected Attributes | List of all members
Castor3D::VertexBuffer Class Reference

Vertex buffer representation. More...

+ Inheritance diagram for Castor3D::VertexBuffer:
+ Collaboration diagram for Castor3D::VertexBuffer:

Public Member Functions

C3D_API VertexBuffer (Engine &p_engine, BufferDeclaration const &p_declaration)
 Constructor. More...
 
C3D_API ~VertexBuffer ()
 Destructor. More...
 
C3D_API bool Create ()
 Creation function. More...
 
BufferDeclaration const & GetDeclaration () const
 Gets buffer declaration. More...
 
template<typename ItType >
void LinkCoords (ItType p_begin, ItType p_end)
 Link all elements to this buffer. More...
 
- Public Member Functions inherited from Castor3D::CpuBuffer< uint8_t >
void Destroy ()
 Destruction function. More...
 
void Cleanup ()
 Cleanup function. More...
 
bool Initialise (eBUFFER_ACCESS_TYPE p_type, eBUFFER_ACCESS_NATURE p_nature)
 Initialisation function, initialises GPU buffer. More...
 
uint8_t * Lock (uint32_t p_offset, uint32_t p_count, uint32_t p_flags)
 Locks the buffer, id est maps it into memory so we can modify it. More...
 
void Unlock ()
 Unlocks the buffer, id est unmaps it from memory so no modification can be made after that. More...
 
bool Fill (uint8_t const *p_buffer, ptrdiff_t p_size, Castor3D::eBUFFER_ACCESS_TYPE p_type, Castor3D::eBUFFER_ACCESS_NATURE p_nature)
 Transmits data to the GPU buffer from RAM. More...
 
bool Bind ()
 Activation function, to tell the GPU it is active. More...
 
void Unbind ()
 Deactivation function, to tell the GPU it is inactive. More...
 
void SetElement (uint32_t p_index, uint8_t const &p_value)
 Sets element value at given index. More...
 
void AddElement (uint8_t const &p_value)
 Adds a value at the end of the buffer. More...
 
uint32_t GetSize () const
 Retrieves the filled buffer size. More...
 
uint32_t GetCapacity () const
 Retrieves the allocated buffer size. More...
 
void Resize (uint32_t p_uiNewSize)
 Sets the allocated size of the buffer. More...
 
void Reserve (uint32_t p_uiIncrement)
 Increases the allocated size of the buffer. More...
 
void Clear ()
 Clears the buffer. More...
 
bool IsToDelete () const
 Retrieves the delete status of the buffer. More...
 
bool IsAssigned () const
 Retrieves the assignment status of the buffer. More...
 
GpuBufferSPtr GetGpuBuffer () const
 Retrieves the GPU buffer. More...
 
void Assign ()
 Sets the assignment status to true. More...
 
void Unassign ()
 Sets the assignment status to false. More...
 
uint8_t const * data () const
 Retrieves the data pointer. More...
 
uint8_t * data ()
 Retrieves the data pointer. More...
 

Protected Attributes

BufferDeclaration m_bufferDeclaration
 Buffer elements description. More...
 
- Protected Attributes inherited from Castor3D::CpuBuffer< uint8_t >
bool m_bToDelete
 Tells the buffer is to be deleted at next render loop. More...
 
bool m_bAssigned
 Tells the buffer has it's GPU buffer assigned. More...
 
GpuBufferSPtr m_pBuffer
 The GPU buffer. More...
 
TArray m_arrayData
 The buffer data. More...
 
uint32_t m_uiSavedSize
 

Additional Inherited Members

- Protected Types inherited from Castor3D::CpuBuffer< uint8_t >
typedef std::shared_ptr< GpuBuffer< uint8_t > > GpuBufferSPtr
 
typedef std::weak_ptr< GpuBuffer< uint8_t > > GpuBufferWPtr
 
typedef std::weak_ptr< CpuBuffer< uint8_t > > CpuBufferWPtr
 
- Protected Member Functions inherited from Castor3D::CpuBuffer< uint8_t >
 DECLARE_TPL_VECTOR (uint8_t, uint8_t)
 
 CpuBuffer (Engine &p_engine)
 Constructor. More...
 
 ~CpuBuffer ()
 Destructor. More...
 

Detailed Description

Vertex buffer representation.

Author
Sylvain DOREMUS
Version
0.1
Date
09/02/2010
Remarks
Holds the submesh vertices informations

Constructor & Destructor Documentation

◆ VertexBuffer()

C3D_API Castor3D::VertexBuffer::VertexBuffer ( Engine p_engine,
BufferDeclaration const &  p_declaration 
)

Constructor.

Parameters
[in]p_engineThe engine.
[in]p_declarationThe buffer declaration.

◆ ~VertexBuffer()

C3D_API Castor3D::VertexBuffer::~VertexBuffer ( )

Destructor.

Member Function Documentation

◆ Create()

C3D_API bool Castor3D::VertexBuffer::Create ( )

Creation function.

Returns
true if OK

◆ GetDeclaration()

BufferDeclaration const& Castor3D::VertexBuffer::GetDeclaration ( ) const
inline

Gets buffer declaration.

Returns
The buffer declaration

References m_bufferDeclaration.

◆ LinkCoords()

template<typename ItType >
void Castor3D::VertexBuffer::LinkCoords ( ItType  p_begin,
ItType  p_end 
)
inline

Link all elements to this buffer.

Parameters
[in]p_begin,p_endThe elements array iterators

References Castor3D::CpuBuffer< T >::data(), Castor3D::BufferDeclaration::GetStride(), and m_bufferDeclaration.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_bufferDeclaration

BufferDeclaration Castor3D::VertexBuffer::m_bufferDeclaration
protected

Buffer elements description.

Referenced by GetDeclaration(), and LinkCoords().


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