Castor3D  ..
Public Member Functions | Protected Types | List of all members
Castor3D::GpuBuffer< T > Class Template Referenceabstract

Base class for renderer dependant buffers. More...

+ Inheritance diagram for Castor3D::GpuBuffer< T >:
+ Collaboration diagram for Castor3D::GpuBuffer< T >:

Public Member Functions

 GpuBuffer (RenderSystem &p_renderSystem)
 Constructor. More...
 
virtual ~GpuBuffer ()
 Destructor. More...
 
virtual bool Create ()
 Creation function. More...
 
virtual void Destroy ()
 Destruction function. More...
 
virtual bool Initialise (eBUFFER_ACCESS_TYPE p_type, eBUFFER_ACCESS_NATURE p_nature)=0
 Initialisation function, used by VBOs. More...
 
virtual void Cleanup ()
 Cleanup function. More...
 
virtual T * Lock (uint32_t p_offset, uint32_t p_count, uint32_t p_flags)=0
 Locks the buffer, id est maps it into memory so we can modify it. More...
 
virtual void Unlock ()=0
 Unlocks the buffer, id est unmaps it from memory so no modification can be made after that. More...
 
virtual bool Bind ()=0
 Activation function, to tell the GPU it is active. More...
 
virtual bool Bind (bool p_instantiated)
 Activation function, to tell the GPU it is active. More...
 
virtual void Unbind ()=0
 Deactivation function, to tell the GPU it is inactive. More...
 
virtual bool Fill (T const *p_buffer, ptrdiff_t p_size, Castor3D::eBUFFER_ACCESS_TYPE p_type, Castor3D::eBUFFER_ACCESS_NATURE p_nature)=0
 Transmits data to the GPU buffer from RAM. More...
 

Protected Types

typedef Castor3D::CpuBuffer< T > * HardwareBufferPtr
 

Detailed Description

template<typename T>
class Castor3D::GpuBuffer< T >

Base class for renderer dependant buffers.

Author
Sylvain DOREMUS
Version
0.6.5.0
Date
22/10/2011

Member Typedef Documentation

◆ HardwareBufferPtr

template<typename T>
typedef Castor3D::CpuBuffer< T >* Castor3D::GpuBuffer< T >::HardwareBufferPtr
protected

Constructor & Destructor Documentation

◆ GpuBuffer()

template<typename T>
Castor3D::GpuBuffer< T >::GpuBuffer ( RenderSystem p_renderSystem)
inline

Constructor.

◆ ~GpuBuffer()

template<typename T>
virtual Castor3D::GpuBuffer< T >::~GpuBuffer ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Bind() [1/2]

template<typename T>
virtual bool Castor3D::GpuBuffer< T >::Bind ( )
pure virtual

Activation function, to tell the GPU it is active.

Returns
true if successful

◆ Bind() [2/2]

template<typename T>
virtual bool Castor3D::GpuBuffer< T >::Bind ( bool  p_instantiated)
inlinevirtual

Activation function, to tell the GPU it is active.

Remarks
Used for instanciation
Parameters
[in]p_instantiatedTells if the buffer is instantiated
Returns
true if successful

◆ Cleanup()

template<typename T>
virtual void Castor3D::GpuBuffer< T >::Cleanup ( void  )
inlinevirtual

Cleanup function.

◆ Create()

template<typename T>
virtual bool Castor3D::GpuBuffer< T >::Create ( )
inlinevirtual

Creation function.

Returns
true if OK

◆ Destroy()

template<typename T>
virtual void Castor3D::GpuBuffer< T >::Destroy ( )
inlinevirtual

Destruction function.

◆ Fill()

template<typename T>
virtual bool Castor3D::GpuBuffer< T >::Fill ( T const *  p_buffer,
ptrdiff_t  p_size,
Castor3D::eBUFFER_ACCESS_TYPE  p_type,
Castor3D::eBUFFER_ACCESS_NATURE  p_nature 
)
pure virtual

Transmits data to the GPU buffer from RAM.

Parameters
[in]p_bufferThe data
[in]p_sizeData buffer size
[in]p_typeTransfer type
[in]p_natureTransfer nature
Returns
true if successful

◆ Initialise()

template<typename T>
virtual bool Castor3D::GpuBuffer< T >::Initialise ( eBUFFER_ACCESS_TYPE  p_type,
eBUFFER_ACCESS_NATURE  p_nature 
)
pure virtual

Initialisation function, used by VBOs.

Parameters
[in]p_typeBuffer access type
[in]p_natureBuffer access nature
Returns
true if OK

◆ Lock()

template<typename T>
virtual T* Castor3D::GpuBuffer< T >::Lock ( uint32_t  p_offset,
uint32_t  p_count,
uint32_t  p_flags 
)
pure virtual

Locks the buffer, id est maps it into memory so we can modify it.

Remarks
Maps from buffer[p_offset*sizeof( T )] to buffer[(p_offset+p_uiSize-1)*sizeof( T )]
Parameters
[in]p_offsetThe start offset in the buffer
[in]p_countThe mapped elements count
[in]p_flagsThe lock flags
Returns
The mapped buffer address

◆ Unbind()

template<typename T>
virtual void Castor3D::GpuBuffer< T >::Unbind ( )
pure virtual

Deactivation function, to tell the GPU it is inactive.

◆ Unlock()

template<typename T>
virtual void Castor3D::GpuBuffer< T >::Unlock ( )
pure virtual

Unlocks the buffer, id est unmaps it from memory so no modification can be made after that.

Remarks
All modifications made in the mapped buffer are put into GPU memory

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