3#include <Engine/RaEngine.hpp>
7#include <nlohmann/json.hpp>
10#include <Core/Utils/Color.hpp>
11#include <Core/Utils/EnumConverter.hpp>
12#include <Core/Utils/Log.hpp>
13#include <Core/Utils/StdOptional.hpp>
15#include <Core/Containers/VariableSet.hpp>
17#include <Engine/Data/ShaderProgram.hpp>
76 using VariableSet::setVariable;
80 VariableSet::setVariable( name,
std::ref( rp ) );
83 VariableSet::setVariable( name,
std::cref( rp ) );
92 visit( StaticParameterBinder {}, shader );
100 class StaticParameterBinder
104 using types = BindableTypes;
111 shader->
setUniform( name.
c_str(), Ra::Core::Utils::Color::VectorType( p ) );
117 const RenderParameters::TextureInfo& p,
119 auto [tex, texUnit] = p;
129 const RenderParameters& p,
130 const Data::ShaderProgram* shader ) {
136 template <
typename T>
137 void operator()(
const std::string& name,
const T& p,
const Data::ShaderProgram* shader ) {
138 shader->setUniform( name.
c_str(), p );
158 static void loadMetaData(
const std::string& basename, nlohmann::json& destination );
173 virtual const RenderParameters& getParameters()
const {
return m_renderParameters; }
Heterogeneous container storing "Variables", that maps a name (std::string) to a value (of any type T...
Interface to define metadata (constraints, description, ...) for the editing of parameter set.
virtual nlohmann::json getParametersMetadata() const =0
Get a json containing metadata about the parameters.
Management of shader parameters with automatic binding of a named parameter to the corresponding glsl...
void setVariable(const std::string &name, RenderParameters &rp)
overload create ref wrapper for RenderParameters variable
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, RenderParameters > BindableTypes
List of bindable types, to be used with static visitors.
void bind(const Data::ShaderProgram *shader) const
Bind the parameter uniform on the shader program.
void setTexture(const std::string &name, T *tex, int texUnit=-1)
Adding a texture parameter.
Shader program parameter provider.
virtual void updateFromParameters()
Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParam...
virtual void updateGL()=0
Update the OpenGL states used by the ShaderParameterProvider.
virtual std::list< std::string > getPropertyList() const
Get the list of properties the provider might use in a shader.
void setUniform(const char *name, const T &value) const
Uniform setters.
void setUniformTexture(const char *name, Texture *tex) const
hepler function to manage enum as underlying types in VariableSet