Castor3D
..
|
Shader variables buffer. More...
Public Member Functions | |
C3D_API | FrameVariableBuffer (Castor::String const &p_name, RenderSystem &p_renderSystem) |
Constructor. More... | |
virtual C3D_API | ~FrameVariableBuffer () |
Destructor. More... | |
C3D_API bool | Initialise (ShaderProgram &p_program) |
Initialises all the variables and the GPU buffer associated. More... | |
C3D_API void | Cleanup () |
Cleans all the variables up and the GPU buffer associated. More... | |
C3D_API bool | Bind (uint32_t p_index) |
Binds all the variables, through the GPU buffer if supported (OpenGL UBO, Direct3D Constants buffers) More... | |
C3D_API void | Unbind (uint32_t p_index) |
Unbinds all variables. More... | |
C3D_API FrameVariableSPtr | CreateVariable (ShaderProgram &p_program, eFRAME_VARIABLE_TYPE p_type, Castor::String const &p_name, uint32_t p_occurences=1) |
Creates a variable of the wanted type. More... | |
C3D_API void | RemoveVariable (Castor::String const &p_name) |
Removes a variable from this buffer. More... | |
template<typename T > | |
std::shared_ptr< OneFrameVariable< T > > | GetVariable (Castor::String const &p_name, std::shared_ptr< OneFrameVariable< T > > &p_variable) const |
Retrieves a variable by name. More... | |
template<typename T , uint32_t Count> | |
std::shared_ptr< PointFrameVariable< T, Count > > | GetVariable (Castor::String const &p_name, std::shared_ptr< PointFrameVariable< T, Count > > &p_variable) const |
Retrieves a variable by name. More... | |
template<typename T , uint32_t Rows, uint32_t Columns> | |
std::shared_ptr< MatrixFrameVariable< T, Rows, Columns > > | GetVariable (Castor::String const &p_name, std::shared_ptr< MatrixFrameVariable< T, Rows, Columns > > &p_variable) const |
Retrieves a variable by name. More... | |
Castor::String const & | GetName () const |
Retrieves the variables buffer name. More... | |
FrameVariablePtrList::iterator | begin () |
Retrieves an iterator to the beginnning of the variables list. More... | |
FrameVariablePtrList::const_iterator | begin () const |
Retrieves an iterator to the beginnning of the variables list. More... | |
FrameVariablePtrList::iterator | end () |
Retrieves an iterator to the end of the variables list. More... | |
FrameVariablePtrList::const_iterator | end () const |
Retrieves an iterator to the end of the variables list. More... | |
Protected Member Functions | |
virtual C3D_API FrameVariableSPtr | DoCreateVariable (ShaderProgram *p_program, eFRAME_VARIABLE_TYPE p_type, Castor::String const &p_name, uint32_t p_occurences=1)=0 |
Creates a variable of the wanted type. More... | |
virtual C3D_API bool | DoInitialise (ShaderProgram *p_program)=0 |
Initialises all the variables and the GPU buffer associated. More... | |
virtual C3D_API void | DoCleanup ()=0 |
Cleans all the variables up and the GPU buffer associated. More... | |
virtual C3D_API bool | DoBind (uint32_t p_index)=0 |
Binds all the variables, through the GPU buffer if supported (OpenGL UBO, Direct3D Constants buffers) More... | |
virtual C3D_API void | DoUnbind (uint32_t p_index)=0 |
Unbinds all variables. More... | |
Protected Attributes | |
uint32_t | m_index |
The buffer's index. More... | |
FrameVariablePtrList | m_listVariables |
The variables list. More... | |
FrameVariablePtrList | m_listInitialised |
The initialised variables list. More... | |
FrameVariablePtrStrMap | m_mapVariables |
The variables ordered by name. More... | |
Castor::String | m_name |
The buffer name. More... | |
Castor::ByteArray | m_buffer |
The data buffer. More... | |
Static Protected Attributes | |
static uint32_t | sm_uiCount |
The buffers count. More... | |
Shader variables buffer.
C3D_API Castor3D::FrameVariableBuffer::FrameVariableBuffer | ( | Castor::String const & | p_name, |
RenderSystem & | p_renderSystem | ||
) |
Constructor.
[in] | p_name | The buffer name |
[in] | p_renderSystem | The render system |
|
virtual |
Destructor.
|
inline |
Retrieves an iterator to the beginnning of the variables list.
References m_listVariables.
|
inline |
Retrieves an iterator to the beginnning of the variables list.
References m_listVariables.
C3D_API bool Castor3D::FrameVariableBuffer::Bind | ( | uint32_t | p_index | ) |
Binds all the variables, through the GPU buffer if supported (OpenGL UBO, Direct3D Constants buffers)
[in] | p_index | The buffer index |
false
if any problem occured C3D_API void Castor3D::FrameVariableBuffer::Cleanup | ( | ) |
Cleans all the variables up and the GPU buffer associated.
C3D_API FrameVariableSPtr Castor3D::FrameVariableBuffer::CreateVariable | ( | ShaderProgram & | p_program, |
eFRAME_VARIABLE_TYPE | p_type, | ||
Castor::String const & | p_name, | ||
uint32_t | p_occurences = 1 |
||
) |
Creates a variable of the wanted type.
[in] | p_program | The program |
[in] | p_type | The wanted type |
[in] | p_name | The variable name |
[in] | p_occurences | The array dimension |
|
protectedpure virtual |
Binds all the variables, through the GPU buffer if supported (OpenGL UBO, Direct3D Constants buffers)
[in] | p_index | The buffer index |
false
if any problem occured
|
protectedpure virtual |
Cleans all the variables up and the GPU buffer associated.
|
protectedpure virtual |
Creates a variable of the wanted type.
[in] | p_program | The program |
[in] | p_type | The wanted type |
[in] | p_name | The variable name |
[in] | p_occurences | The array dimension |
|
protectedpure virtual |
Initialises all the variables and the GPU buffer associated.
[in] | p_program | The program |
false
if any problem occured
|
protectedpure virtual |
Unbinds all variables.
[in] | p_index | The buffer index |
|
inline |
Retrieves an iterator to the end of the variables list.
References m_listVariables.
|
inline |
Retrieves an iterator to the end of the variables list.
References m_listVariables.
|
inline |
std::shared_ptr< OneFrameVariable< T > > Castor3D::FrameVariableBuffer::GetVariable | ( | Castor::String const & | p_name, |
std::shared_ptr< OneFrameVariable< T > > & | p_variable | ||
) | const |
Retrieves a variable by name.
[in] | p_name | The variable name |
[out] | p_variable | Receives the found variable, nullptr if failed |
false
if failed std::shared_ptr< PointFrameVariable< T, Count > > Castor3D::FrameVariableBuffer::GetVariable | ( | Castor::String const & | p_name, |
std::shared_ptr< PointFrameVariable< T, Count > > & | p_variable | ||
) | const |
Retrieves a variable by name.
[in] | p_name | The variable name |
[out] | p_variable | Receives the found variable, nullptr if failed |
false
if failed std::shared_ptr< MatrixFrameVariable< T, Rows, Columns > > Castor3D::FrameVariableBuffer::GetVariable | ( | Castor::String const & | p_name, |
std::shared_ptr< MatrixFrameVariable< T, Rows, Columns > > & | p_variable | ||
) | const |
Retrieves a variable by name.
[in] | p_name | The variable name |
[out] | p_variable | Receives the found variable, nullptr if failed |
false
if failed C3D_API bool Castor3D::FrameVariableBuffer::Initialise | ( | ShaderProgram & | p_program | ) |
Initialises all the variables and the GPU buffer associated.
[in] | p_program | The program |
false
if any problem occured C3D_API void Castor3D::FrameVariableBuffer::RemoveVariable | ( | Castor::String const & | p_name | ) |
Removes a variable from this buffer.
[in] | p_name | The variable name |
C3D_API void Castor3D::FrameVariableBuffer::Unbind | ( | uint32_t | p_index | ) |
Unbinds all variables.
[in] | p_index | The buffer index |
|
protected |
The data buffer.
|
protected |
The buffer's index.
|
protected |
The initialised variables list.
|
protected |
|
protected |
The variables ordered by name.
|
protected |
The buffer name.
Referenced by GetName().
|
staticprotected |
The buffers count.