Gazebo Rendering

API Reference

6.6.3
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...
 
ShaderParamoperator= (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
Enumerator
PARAM_NONE 

Type none.

PARAM_FLOAT 

Float type parameter.

PARAM_INT 

Integer type parameter.

PARAM_FLOAT_BUFFER 

Float Buffer type parameter.

PARAM_INT_BUFFER 

Int Buffer type parameter.

PARAM_TEXTURE 

texture type parameter

PARAM_TEXTURE_CUBE 

cube map type parameter

Constructor & Destructor Documentation

◆ ShaderParam() [1/2]

constructor

◆ ShaderParam() [2/2]

ShaderParam ( const ShaderParam _other)

copy constructor

Parameters
[in]_otherAnother 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]_buffervariable 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]_countNumber of 32-bit elements in the buffer

◆ operator=() [1/3]

void operator= ( const float  _value)

Set this to be a float parameter.

Parameters
[in]_valueValue to set this parameter to

◆ operator=() [2/3]

void operator= ( const int  _value)

Set this to be an integer parameter.

Parameters
[in]_valueValue to set this parameter to

◆ operator=() [3/3]

ShaderParam& operator= ( const ShaderParam _other)

Set from another ShaderParam.

Parameters
[in]_otherAnother 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]_valueValue to set this parameter to
[in]_typeType of texture
[in]_uvSetIndexTexture 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]_floatBufferSource buffer to copy from

◆ UpdateBuffer() [2/2]

void UpdateBuffer ( int *  _intBuffer)

Copy a buffer to this parameter.

Parameters
[in]_intBufferSource 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]_valuevariable 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]_valuevariable 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]_valuevariable the value will be copied to
[out]_uvSetIndexTexture coordinate set index
Returns
true if the parameter filled

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