Radium Engine
1.5.20
|
Management of shader parameters with automatic binding of a named parameter to the corresponding glsl uniform. More...
#include <Engine/Data/RenderParameters.hpp>
Public Types | |
using | TextureInfo = std::pair<Data::Texture*, int> |
Special type for Texture parameter. | |
using | BindableTypes |
List of bindable types, to be used with static visitors. | |
Public Types inherited from Ra::Core::VariableSet | |
template<typename T > | |
using | VariableContainer = std::map<std::string, T> |
Container type for the mapping name->value of variables with type T. | |
template<typename T > | |
using | Variable = typename VariableContainer<T>::value_type |
Variable type as stored in the VariableSet. | |
template<typename T > | |
using | VariableType = typename Variable<T>::second_type |
Type of the variable value. | |
template<typename T > | |
using | VariableHandle = typename VariableContainer<T>::iterator |
Handle of a variable A handle on a variable with type T is an iterator into the BaseContainer. De-referencing the handle give access to a non const pair <const std::string, T> (BaseContainer<T>::value_type). VariableHandle validity follows the rules of BaseContainer<T>::iterator validity. | |
template<typename H > | |
using | VariableTypeFromHandle = typename std::iterator_traits<H>::value_type::second_type |
Type of the variable referenced by a VariableHandle. | |
Public Member Functions | |
template<typename T , typename std::enable_if< std::is_base_of< Data::Texture, T >::value, bool >::type = true> | |
void | setTexture (const std::string &name, T *tex, int texUnit=-1) |
Adding a texture parameter. | |
void | setVariable (const std::string &name, RenderParameters &rp) |
overload create ref wrapper for RenderParameters variable | |
void | setVariable (const std::string &name, const RenderParameters &rp) |
void | bind (const Data::ShaderProgram *shader) const |
Bind the parameter uniform on the shader program. | |
template<typename T > | |
auto | setVariable (const std::string &name, const T &value) -> std::pair< VariableHandle< T >, bool > |
reset (or set if the variable does not exist yet) the value of the variable. | |
Public Member Functions inherited from Ra::Core::VariableSet | |
template<typename F , typename U > | |
void | visitStatic (F &&visitor, U &userParams) const |
template<typename F , typename U > | |
void | visitStatic (F &&visitor, U &&userParams) const |
VariableSet () | |
VariableSet (const VariableSet &other) noexcept | |
A VariableSet is copyable. | |
VariableSet (VariableSet &&other) noexcept | |
A VariableSet is movable. | |
auto | operator= (const VariableSet &other) -> VariableSet & |
Copy assignment operator. | |
auto | operator= (VariableSet &&other) noexcept -> VariableSet & |
Move assignment operator. | |
void | clear () |
remove all elements from the container | |
void | mergeKeepVariables (const VariableSet &from) |
Merge the VariableSet from into this. | |
void | mergeReplaceVariables (const VariableSet &from) |
Merge the VariableSet from into this. | |
size_t | size () const |
Gets the total number of variables (of any type) | |
auto | getStoredTypes () const -> const std::vector< std::type_index > & |
Gets the stored data type. | |
template<typename T > | |
auto | insertVariable (const std::string &name, const T &value) -> std::pair< VariableHandle< T >, bool > |
Add a variable, i.e. an association name->value, into the container. | |
template<typename T > | |
auto | getVariable (const std::string &name) const -> const T & |
get the value of the given variable | |
template<typename T > | |
auto | getVariable (const std::string &name) -> T & |
template<typename T > | |
auto | getVariableHandle (const std::string &name) const -> const VariableHandle< T > |
get the handle on the variable with the given name | |
template<typename H > | |
bool | isHandleValid (const H &handle) const |
Test the validity of a handle. | |
template<typename T > | |
auto | setVariable (const std::string &name, const T &value) -> std::pair< VariableHandle< T >, bool > |
reset (or set if the variable does not exist yet) the value of the variable. | |
template<typename T > | |
bool | deleteVariable (const std::string &name) |
Remove a variable, i.e. a name->value association. | |
template<typename H > | |
bool | deleteVariable (H &handle) |
delete a variable from its handle | |
template<typename T > | |
auto | existsVariable (const std::string &name) const -> Utils::optional< VariableHandle< T > > |
test the existence of the given variable | |
template<typename T > | |
auto | existsVariableType () const -> Utils::optional< VariableContainer< T > * > |
Test if the storage supports a given variable type. | |
template<typename T > | |
bool | deleteAllVariables () |
Removes all variables of the given type. | |
template<typename T > | |
auto | getAllVariables () const -> VariableContainer< T > & |
Get the whole container for variables of a given type. | |
template<typename H > | |
auto | getAllVariablesFromHandle (const H &handle) -> VariableContainer< VariableTypeFromHandle< H > > & |
Get the whole container for variables of the same type than the given handled variable. | |
template<typename T > | |
size_t | numberOf () const |
Get the number of variables of the given type. | |
template<typename F > | |
void | visit (F &&visitor) const |
Visit the container using a user defined visitor. | |
template<typename F , typename T > | |
void | visit (F &&visitor, T &userParams) const |
overload of the static visit method to allow a parameter pass by reference | |
template<typename F , typename T > | |
void | visit (F &&visitor, T &&userParams) const |
overload of the static visit method to allow a parameter pass by rvalue reference | |
Management of shader parameters with automatic binding of a named parameter to the corresponding glsl uniform.
getAllVariable<typename std::underlying_type<typename Enum>::type>
Definition at line 34 of file RenderParameters.hpp.
List of bindable types, to be used with static visitors.
Definition at line 43 of file RenderParameters.hpp.
Special type for Texture parameter.
Definition at line 40 of file RenderParameters.hpp.
|
inline |
Bind the parameter uniform on the shader program.
shader | The shader to bind to. |
Definition at line 92 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 73 of file RenderParameters.hpp.
|
inline |
Definition at line 83 of file RenderParameters.hpp.
auto Ra::Core::VariableSet::setVariable | ( | const std::string & | name, |
const T & | value ) -> std::pair<VariableHandle<T>, bool> |
reset (or set if the variable does not exist yet) the value of the variable.
Definition at line 191 of file VariableSet.hpp.
|
inline |
overload create ref wrapper for RenderParameters variable
Definition at line 80 of file RenderParameters.hpp.