Castor3D
..
|
3D Buffer management class More...
Public Member Functions | |
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... | |
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 (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, T const &p_value) |
Sets element value at given index. More... | |
void | AddElement (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... | |
T const * | data () const |
Retrieves the data pointer. More... | |
T * | data () |
Retrieves the data pointer. More... | |
Protected Types | |
typedef std::shared_ptr< GpuBuffer< T > > | GpuBufferSPtr |
typedef std::weak_ptr< GpuBuffer< T > > | GpuBufferWPtr |
typedef std::weak_ptr< CpuBuffer< T > > | CpuBufferWPtr |
Protected Member Functions | |
DECLARE_TPL_VECTOR (T, T) | |
CpuBuffer (Engine &p_engine) | |
Constructor. More... | |
~CpuBuffer () | |
Destructor. More... | |
Protected Attributes | |
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 |
3D Buffer management class
|
protected |
|
protected |
|
protected |
|
inlineprotected |
Constructor.
[in] | p_engine | The engine |
|
inlineprotected |
Destructor.
|
inline |
Adds a value at the end of the buffer.
[in] | p_value | The value |
|
inline |
Sets the assignment status to true
.
|
inline |
Activation function, to tell the GPU it is active.
true
if successful
|
inline |
Cleanup function.
|
inline |
Clears the buffer.
|
inline |
Retrieves the data pointer.
Referenced by Castor3D::VertexBuffer::LinkCoords().
|
inline |
Retrieves the data pointer.
|
protected |
|
inline |
Destruction function.
|
inline |
Transmits data to the GPU buffer from RAM.
[in] | p_buffer | The data |
[in] | p_size | Data buffer size |
[in] | p_type | Transfer type |
[in] | p_nature | Transfer nature |
true
if successful
|
inline |
Retrieves the allocated buffer size.
Referenced by Castor3D::CpuBuffer< uint8_t >::Reserve().
|
inline |
Retrieves the GPU buffer.
Referenced by Castor3D::CpuBuffer< uint8_t >::Bind(), Castor3D::CpuBuffer< uint8_t >::Cleanup(), Castor3D::CpuBuffer< uint8_t >::Destroy(), Castor3D::CpuBuffer< uint8_t >::Fill(), Castor3D::CpuBuffer< uint8_t >::Initialise(), Castor3D::CpuBuffer< uint8_t >::Lock(), Castor3D::CpuBuffer< uint8_t >::Unbind(), and Castor3D::CpuBuffer< uint8_t >::Unlock().
|
inline |
Retrieves the filled buffer size.
|
inline |
Initialisation function, initialises GPU buffer.
[in] | p_type | Buffer access type |
[in] | p_nature | Buffer access nature |
true
if OK
|
inline |
Retrieves the assignment status of the buffer.
|
inline |
Retrieves the delete status of the buffer.
|
inline |
Locks the buffer, id est maps it into memory so we can modify it.
[in] | p_offset | The start offset in the buffer |
[in] | p_count | The mapped elements count |
[in] | p_flags | The lock flags |
|
inline |
Increases the allocated size of the buffer.
[in] | p_uiIncrement | The size increment |
|
inline |
Sets the allocated size of the buffer.
[in] | p_uiNewSize | The new size |
|
inline |
Sets element value at given index.
[in] | p_index | The index |
[in] | p_value | The value |
|
inline |
Sets the assignment status to false
.
|
inline |
Deactivation function, to tell the GPU it is inactive.
true
if successful
|
inline |
Unlocks the buffer, id est unmaps it from memory so no modification can be made after that.
|
protected |
The buffer data.
The saved buffer size (to still have a size after clear)
Referenced by Castor3D::CpuBuffer< uint8_t >::AddElement(), Castor3D::CpuBuffer< uint8_t >::Clear(), Castor3D::CpuBuffer< uint8_t >::data(), Castor3D::CpuBuffer< uint8_t >::GetCapacity(), Castor3D::CpuBuffer< uint8_t >::GetSize(), Castor3D::CpuBuffer< uint8_t >::Reserve(), Castor3D::CpuBuffer< uint8_t >::Resize(), and Castor3D::CpuBuffer< uint8_t >::SetElement().
|
protected |
Tells the buffer has it's GPU buffer assigned.
Referenced by Castor3D::CpuBuffer< uint8_t >::Assign(), Castor3D::CpuBuffer< uint8_t >::IsAssigned(), and Castor3D::CpuBuffer< uint8_t >::Unassign().
|
protected |
Tells the buffer is to be deleted at next render loop.
Referenced by Castor3D::CpuBuffer< uint8_t >::IsToDelete().
|
protected |
The GPU buffer.
Referenced by Castor3D::CpuBuffer< uint8_t >::Destroy(), and Castor3D::CpuBuffer< uint8_t >::GetGpuBuffer().
|
protected |
Referenced by Castor3D::CpuBuffer< uint8_t >::Clear(), and Castor3D::CpuBuffer< uint8_t >::GetSize().