1 #include <Core/Utils/Log.hpp>
3 #include <Engine/Data/RenderParameters.hpp>
4 #include <Engine/RadiumEngine.hpp>
11 RenderParameters::StaticParameterBinder RenderParameters::s_binder;
14 m_parameterSets.
visit( s_binder, shader );
19 std::function<void(
Core::VariableSet&,
const std::string&,
const std::string& )>>( name );
20 if ( converterFunc ) { ( *converterFunc )->second( m_parameterSets, name, value ); }
22 LOG( Core::Utils::logWARNING )
23 <<
"RenderParameters, try to set enum value from string without converter. Adding "
24 "non-bindable TParameter<string> "
25 << name <<
" " << value;
43 nlohmann::json& destination ) {
44 auto resourcesRootDir { RadiumEngine::getInstance()->getResourcesDir() };
45 std::string metadataFileName =
"Metadata/" + basename +
".json";
46 std::ifstream metadata( resourcesRootDir + metadataFileName );
47 if ( metadata ) { metadata >> destination; }
49 LOG( Core::Utils::logERROR )
50 <<
"RenderParameters : failed to load metadata file " << metadataFileName;
Heterogeneous container storing "Variables", that maps a name (std::string) to a value (of any type T...
auto insertOrAssignVariable(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.
auto existsVariable(const std::string &name) const -> Utils::optional< VariableHandle< T >>
test the existence of the given variable
void mergeKeepVariables(const VariableSet &from)
Merge the VariableSet from into this.
void mergeReplaceVariables(const VariableSet &from)
Merge the VariableSet from into this.
void visit(F &&visitor) const
Visit the container using a user defined visitor.
static void loadMetaData(const std::string &basename, nlohmann::json &destination)
Load the ParameterSet description.
void addParameter(const std::string &name, T value, typename std::enable_if<!std::is_class< T > {}, bool >::type=true)
Add a parameter by value.
void bind(const Data::ShaderProgram *shader) const
const Core::VariableSet & getStorage() const
Get access to the parameter storage.
void mergeReplaceParameters(const RenderParameters ¶ms)
void mergeKeepParameters(const RenderParameters ¶ms)