Radium Engine
1.5.0
|
#include <Engine/Data/RenderParameters.hpp>
Public Types | |
using | TextureInfo = std::pair< Data::Texture *, int > |
Special type for Texture parameter. | |
using | BindableTypes = Core::Utils::TypeList< bool, Core::Utils::Color, int, uint, Scalar, TextureInfo, std::vector< int >, std::vector< uint >, std::vector< Scalar >, Core::Vector2, Core::Vector3, Core::Vector4, Core::Matrix2, Core::Matrix3, Core::Matrix4, std::reference_wrapper< RenderParameters >, std::reference_wrapper< const RenderParameters > > |
Aliases for bindable parameter types. More... | |
template<typename T > | |
using | UniformBindableSet = Core::VariableSet::VariableContainer< T > |
template<typename T > | |
using | UniformVariable = Core::VariableSet::VariableHandle< T > |
Public Member Functions | |
template<typename EnumBaseType > | |
void | addEnumConverter (const std::string &name, std::shared_ptr< Core::Utils::EnumConverter< EnumBaseType >> converter) |
Associate a converter for enumerated type to the given parameter name. More... | |
template<typename EnumBaseType > | |
Core::Utils::optional< std::shared_ptr< Core::Utils::EnumConverter< EnumBaseType > > > | getEnumConverter (const std::string &name) |
Search for a converter associated with an enumeration parameter. More... | |
template<typename Enum , typename std::enable_if< std::is_enum< Enum > {}, bool >::type = true> | |
std::string | getEnumString (const std::string &name, Enum value) |
Return the string associated to the actual value of a parameter. More... | |
template<typename EnumBaseType > | |
std::string | getEnumString (const std::string &name, EnumBaseType value, typename std::enable_if<!std::is_enum< EnumBaseType > {}, bool >::type=true) |
(overload) Return the string associated to the actual value of a parameter, from a value with underlying_type<Enum>. More... | |
template<typename T > | |
bool | removeParameter (const std::string &name) |
Remove the given parameter from the parameterSet. More... | |
void | mergeKeepParameters (const RenderParameters ¶ms) |
void | mergeReplaceParameters (const RenderParameters ¶ms) |
void | bind (const Data::ShaderProgram *shader) const |
template<typename T > | |
Core::Utils::optional< UniformBindableSet< T > * > | hasParameterSet () const |
Test if parameters of type T are stored. More... | |
template<typename T > | |
Core::Utils::optional< UniformVariable< T > > | containsParameter (const std::string &name) const |
template<typename V > | |
void | visit (V &&visitor) const |
template<typename V , typename T > | |
void | visit (V &&visitor, T &userParams) const |
template<typename V , typename T > | |
void | visit (V &&visitor, T &&userParams) const |
template<typename T > | |
void | addParameter (const std::string &name, T value, typename std::enable_if<!std::is_class< T > {}, bool >::type=true) |
Add a parameter by value. More... | |
template<typename T , typename std::enable_if< std::is_class< T > {}, bool >::type = true> | |
void | addParameter (const std::string &name, const T &value) |
Add a parameter by const ref. More... | |
template<typename T , typename std::enable_if< std::is_base_of< Data::Texture, T >::value, bool >::type = true> | |
void | addParameter (const std::string &name, T *tex, int texUnit=-1) |
Adding a texture parameter. More... | |
void | addParameter (const std::string &name, const std::string &value) |
set the value of the given parameter, according to a string representation of an enum. More... | |
void | addParameter (const std::string &name, const char *value) |
void | addParameter (const std::string &name, RenderParameters &value) |
add a render parameter variable More... | |
void | addParameter (const std::string &name, const RenderParameters &value) |
template<typename T > | |
const UniformBindableSet< T > & | getParameterSet () const |
Get a typed parameter set. More... | |
template<typename T > | |
UniformBindableSet< T > & | getParameterSet () |
template<typename T > | |
const T & | getParameter (const std::string &name) const |
Get a typed parameter. More... | |
template<typename T > | |
T & | getParameter (const std::string &name) |
const Core::VariableSet & | getStorage () const |
Get access to the parameter storage. More... | |
Core::VariableSet & | getStorage () |
Management of shader parameters with automatic binding of a named parameter to the corresponding glsl uniform.
getParameterSet<typename std::underlying_type<typename Enum>::type>
Definition at line 35 of file RenderParameters.hpp.
using Ra::Engine::Data::RenderParameters::BindableTypes = Core::Utils::TypeList<bool, Core::Utils::Color, int, uint, Scalar, TextureInfo, std::vector<int>, std::vector<uint>, std::vector<Scalar>, Core::Vector2, Core::Vector3, Core::Vector4, Core::Matrix2, Core::Matrix3, Core::Matrix4, std::reference_wrapper<RenderParameters>, std::reference_wrapper<const RenderParameters> > |
Aliases for bindable parameter types.
List of bindable types, to be used with static visitors
Definition at line 47 of file RenderParameters.hpp.
using Ra::Engine::Data::RenderParameters::UniformBindableSet = Core::VariableSet::VariableContainer<T> |
Set of typed parameters For a given shader Program, all the parameters are stored by type, using Core::VariableSet as container.
T | The type of parameters in the set. |
Definition at line 72 of file RenderParameters.hpp.
using Ra::Engine::Data::RenderParameters::UniformVariable = Core::VariableSet::VariableHandle<T> |
Handle to a bindable parameters. A handle is an iterator on a pair <name, value> such that the value is of type T
T | The type of parameter in the set. |
Definition at line 80 of file RenderParameters.hpp.
void Ra::Engine::Data::RenderParameters::addEnumConverter | ( | const std::string & | name, |
std::shared_ptr< Core::Utils::EnumConverter< EnumBaseType >> | converter | ||
) |
Associate a converter for enumerated type to the given parameter name.
EnumBaseType | The enum base type to manage ( |
name | |
converter |
Definition at line 408 of file RenderParameters.hpp.
void Ra::Engine::Data::RenderParameters::addParameter | ( | const std::string & | name, |
const std::string & | value | ||
) |
set the value of the given parameter, according to a string representation of an enum.
name | Name of the parameter |
value | value of the parameter |
Definition at line 17 of file RenderParameters.cpp.
|
inline |
Add a parameter by const ref.
T | The type of parameter to add. Must be a class type for this overload to be chosen. |
name | Name of the parameter. |
value | Value of the parameter. |
Definition at line 466 of file RenderParameters.hpp.
|
inline |
add a render parameter variable
name | |
value |
Definition at line 475 of file RenderParameters.hpp.
|
inline |
Adding a texture parameter.
T | The type of parameter to add. Must be derived from Texture for this overload. |
name | Name of the parameter |
tex | Texture to add in the parameterSet |
texUnit | Texture unit associated with the texture object. The default (-1) for the texUnit parameter implies automatic uniform binding for the texture unit associated with the named sampler. If texUnit is given, then uniform binding will be made at this explicit location. |
Definition at line 471 of file RenderParameters.hpp.
|
inline |
Add a parameter by value.
Overloaded operators to set shader parameters
T | The type of parameter to add. Must be a non class type for this overload to be chosen. |
name | Name of the parameter. |
value | Value of the parameter. |
Definition at line 455 of file RenderParameters.hpp.
void Ra::Engine::Data::RenderParameters::bind | ( | const Data::ShaderProgram * | shader | ) | const |
Bind the parameter uniform on the shader program
shader | The shader to bind to. |
Definition at line 13 of file RenderParameters.cpp.
|
inline |
Check if a typed parameter exists
T | the type of the parameter to get |
name | The name of the parameter to get |
Definition at line 513 of file RenderParameters.hpp.
Core::Utils::optional< std::shared_ptr< Core::Utils::EnumConverter< EnumBaseType > > > Ra::Engine::Data::RenderParameters::getEnumConverter | ( | const std::string & | name | ) |
Search for a converter associated with an enumeration parameter.
EnumBaseType | The enum base type to manage ( |
name | the name of the parameter |
Definition at line 423 of file RenderParameters.hpp.
std::string Ra::Engine::Data::RenderParameters::getEnumString | ( | const std::string & | name, |
Enum | value | ||
) |
Return the string associated to the actual value of a parameter.
Enum | The enum type ( |
name | The name of the enum variable |
value | The value to convert |
Definition at line 446 of file RenderParameters.hpp.
std::string Ra::Engine::Data::RenderParameters::getEnumString | ( | const std::string & | name, |
EnumBaseType | value, | ||
typename std::enable_if<!std::is_enum< EnumBaseType > {}, bool >::type | = true |
||
) |
(overload) Return the string associated to the actual value of a parameter, from a value with underlying_type<Enum>.
EnumBaseType | The underlying enum type ( |
name | The name of the enum variable |
value | The value to convert |
Definition at line 432 of file RenderParameters.hpp.
|
inline |
Get a typed parameter.
T | the type of the parameter to get |
name | The name of the parameter to get |
std::out_of_range | if the container does not have an parameter with the specified name |
Definition at line 521 of file RenderParameters.hpp.
|
inline |
Get a typed parameter set.
T | the type of the parameter set to get |
Definition at line 490 of file RenderParameters.hpp.
|
inline |
Get access to the parameter storage.
Definition at line 276 of file RenderParameters.hpp.
|
inline |
Test if parameters of type T are stored.
T |
Definition at line 501 of file RenderParameters.hpp.
void Ra::Engine::Data::RenderParameters::mergeKeepParameters | ( | const RenderParameters & | params | ) |
Merges a RenderParameters params with this
params | the render parameter to merge with the current. Existing parameter value are kept from this |
Definition at line 34 of file RenderParameters.cpp.
void Ra::Engine::Data::RenderParameters::mergeReplaceParameters | ( | const RenderParameters & | params | ) |
Merges a RenderParameters params with this
params | the render parameter to merge with the current. Existing parameter values are replaced by params's one. |
Definition at line 38 of file RenderParameters.cpp.
bool Ra::Engine::Data::RenderParameters::removeParameter | ( | const std::string & | name | ) |
Remove the given parameter from the parameterSet.
T | Type of the parameter to remove |
name | Name of the parameter to remove |
Definition at line 485 of file RenderParameters.hpp.
|
inline |
Visit the parameter using any kind of visitor
Definition at line 536 of file RenderParameters.hpp.