ShaderParam Class Reference
a variant type that holds params that can be passed to a shader More...
#include <ShaderParam.hh>
Public Types | |
enum | ParamType : uint16_t { PARAM_NONE = 0, PARAM_FLOAT = 1, PARAM_INT = 2, PARAM_FLOAT_BUFFER = 3, PARAM_INT_BUFFER = 4, PARAM_TEXTURE = 5, PARAM_TEXTURE_CUBE = 6 } |
Public Member Functions | |
ShaderParam () | |
constructor More... | |
ShaderParam (const ShaderParam &_other) | |
copy constructor More... | |
~ShaderParam () | |
destructor More... | |
bool | Buffer (std::shared_ptr< void > &_buffer) const |
Get the value of this parameter if it is a buffer. More... | |
uint32_t | Count () const |
Get the element count of this parameter's buffer. More... | |
void | InitializeBuffer (uint32_t _count) |
Set this to be a buffer parameter. More... | |
void | operator= (const float _value) |
Set this to be a float parameter. More... | |
void | operator= (const int _value) |
Set this to be an integer parameter. More... | |
ShaderParam & | operator= (const ShaderParam &_other) |
Set from another ShaderParam. More... | |
void | SetTexture (const std::string &_value, ShaderParam::ParamType _type=ShaderParam::ParamType::PARAM_TEXTURE, uint32_t _uvSetIndex=0u) |
Set this to be a texture parameter. More... | |
ParamType | Type () const |
Get the type of this parameter. More... | |
void | UpdateBuffer (float *_floatBuffer) |
Copy a buffer to this parameter. More... | |
void | UpdateBuffer (int *_intBuffer) |
Copy a buffer to this parameter. More... | |
bool | Value (float *_value) const |
Get the value of this parameter if it is a float. More... | |
bool | Value (int *_value) const |
Get the value of this parameter if it is an int. More... | |
bool | Value (std::string &_value, uint32_t &_uvSetIndex) const |
Get the value of this parameter if it is a texture. More... | |
Detailed Description
a variant type that holds params that can be passed to a shader
Member Enumeration Documentation
◆ ParamType
enum ParamType : uint16_t |
Constructor & Destructor Documentation
◆ ShaderParam() [1/2]
ShaderParam | ( | ) |
constructor
◆ ShaderParam() [2/2]
ShaderParam | ( | const ShaderParam & | _other | ) |
copy constructor
- Parameters
-
[in] _other Another ShaderParam
◆ ~ShaderParam()
~ShaderParam | ( | ) |
destructor
Member Function Documentation
◆ Buffer()
bool Buffer | ( | std::shared_ptr< void > & | _buffer | ) | const |
Get the value of this parameter if it is a buffer.
- Parameters
-
[out] _buffer variable the value will be copied to
- Returns
- true if the parameter is the expected type
◆ Count()
uint32_t Count | ( | ) | const |
Get the element count of this parameter's buffer.
- Returns
- Count of elements in this parameter's buffer
◆ InitializeBuffer()
void InitializeBuffer | ( | uint32_t | _count | ) |
Set this to be a buffer parameter.
- Parameters
-
[in] _count Number of 32-bit elements in the buffer
◆ operator=() [1/3]
void operator= | ( | const float | _value | ) |
Set this to be a float parameter.
- Parameters
-
[in] _value Value to set this parameter to
◆ operator=() [2/3]
void operator= | ( | const int | _value | ) |
Set this to be an integer parameter.
- Parameters
-
[in] _value Value to set this parameter to
◆ operator=() [3/3]
ShaderParam& operator= | ( | const ShaderParam & | _other | ) |
Set from another ShaderParam.
- Parameters
-
[in] _other Another ShaderParam
- Returns
- Reference to this ShaderParam
◆ SetTexture()
void SetTexture | ( | const std::string & | _value, |
ShaderParam::ParamType | _type = ShaderParam::ParamType::PARAM_TEXTURE , |
||
uint32_t | _uvSetIndex = 0u |
||
) |
Set this to be a texture parameter.
- Parameters
-
[in] _value Value to set this parameter to [in] _type Type of texture [in] _uvSetIndex Texture coordinate set index
◆ Type()
ParamType Type | ( | ) | const |
Get the type of this parameter.
- Returns
- Type of this parameter
◆ UpdateBuffer() [1/2]
void UpdateBuffer | ( | float * | _floatBuffer | ) |
Copy a buffer to this parameter.
- Parameters
-
[in] _floatBuffer Source buffer to copy from
◆ UpdateBuffer() [2/2]
void UpdateBuffer | ( | int * | _intBuffer | ) |
Copy a buffer to this parameter.
- Parameters
-
[in] _intBuffer Source buffer to copy from
◆ Value() [1/3]
bool Value | ( | float * | _value | ) | const |
Get the value of this parameter if it is a float.
- Parameters
-
[out] _value variable the value will be copied to
- Returns
- true if the parameter is the expected type
◆ Value() [2/3]
bool Value | ( | int * | _value | ) | const |
Get the value of this parameter if it is an int.
- Parameters
-
[out] _value variable the value will be copied to
- Returns
- true if the parameter is the expected type
◆ Value() [3/3]
bool Value | ( | std::string & | _value, |
uint32_t & | _uvSetIndex | ||
) | const |
Get the value of this parameter if it is a texture.
- Parameters
-
[out] _value variable the value will be copied to [out] _uvSetIndex Texture coordinate set index
- Returns
- true if the parameter filled
The documentation for this class was generated from the following file: