Ignition Rendering

API Reference

5.1.0
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
}
 

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...
 
ShaderParamoperator= (const ShaderParam &_other)
 Set from another ShaderParam. 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...
 
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...
 

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.

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]

ShaderParam& operator= ( const ShaderParam _other)

Set from another ShaderParam.

Parameters
[in]_otherAnother ShaderParam
Returns
Reference to this ShaderParam

◆ operator=() [2/3]

void operator= ( const float  _value)

Set this to be a float parameter.

Parameters
[in]_valueValue to set this parameter to

◆ operator=() [3/3]

void operator= ( const int  _value)

Set this to be an integer parameter.

Parameters
[in]_valueValue to set this parameter to

◆ 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/2]

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/2]

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

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